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

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: #f0f4f8;
  color: #2c3e50;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1a5276 0%, #2e86c1 100%);
  color: white;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-title { font-size: 17px; font-weight: 700; flex: 1; }

.header-user {
  font-size: 13px;
  opacity: 0.85;
  margin-right: 12px;
}

.header-logout {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.header-logout:hover { background: rgba(255,255,255,0.3); }

/* ===== LOGIN ===== */
#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px);
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  text-align: center;
  width: 320px;
}

.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-card h2 { font-size: 18px; margin-bottom: 8px; }
.login-card p { font-size: 13px; color: #888; margin-bottom: 24px; }

.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
}

.login-card input:focus { outline: none; border-color: #2e86c1; }

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, #2e86c1, #1a5276);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.login-btn:hover { opacity: 0.9; }
.login-error { color: #e74c3c; font-size: 13px; margin-top: 8px; display: none; }
.login-error.visible { display: block; }

/* ===== MAIN ===== */
#mainScreen { display: none; }

.toolbar {
  background: white;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar select, .toolbar input {
  padding: 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  background: white;
}

.toolbar select:focus, .toolbar input:focus { outline: none; border-color: #2e86c1; }

.toolbar-spacer { flex: 1; }

.btn-export {
  background: #27ae60;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-export:hover { background: #1e8449; }

.btn-refresh {
  background: #f5f5f5;
  color: #555;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn-refresh:hover { background: #e8e8e8; }

/* ===== TABLE ===== */
.table-container {
  padding: 24px;
  overflow-x: auto;
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
  min-width: 120px;
}

.stat-num { font-size: 28px; font-weight: 700; color: #2e86c1; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

thead { background: #1a5276; color: white; }

th {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fbff; }

.book-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-view {
  background: #eaf4ff;
  color: #2e86c1;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn-view:hover { background: #d0e8ff; }

.empty-msg {
  text-align: center;
  padding: 60px;
  color: #aaa;
  font-size: 14px;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 { font-size: 17px; margin-bottom: 20px; color: #1a5276; }

.detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.detail-label {
  font-weight: 600;
  color: #555;
  min-width: 120px;
  flex-shrink: 0;
}

.detail-items { list-style: none; }
.detail-items li::before { content: '✅ '; }
.detail-items li { margin-bottom: 6px; font-size: 13px; color: #444; }

.sig-img {
  border: 1px solid #ddd;
  border-radius: 8px;
  max-width: 100%;
  margin-top: 8px;
}

.modal-close {
  background: #f5f5f5;
  color: #555;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 20px;
}
.modal-close:hover { background: #e8e8e8; }

.consent-number-badge {
  font-size: 18px;
  font-weight: 700;
  color: #1a5276;
  background: #eaf4ff;
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
  margin-bottom: 16px;
}

.loading { text-align: center; padding: 60px; color: #aaa; }
