body { font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans JP", sans-serif; margin: 24px; }
header { display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; }
h1 { margin: 0; font-size: 30px; font-weight: bold;}
.muted { color:#666; }
.card { border: 1px solid #ddd; border-radius: 12px; padding: 16px; margin-top: 16px; }
.row { display:flex; gap: 12px; flex-wrap: wrap; align-items: end; }
label { display:block; font-size: 14px; margin-bottom: 6px; color:#333; }
input { padding: 10px 12px; border:1px solid #ccc; border-radius: 10px; min-width: 260px; }
button { padding: 10px 14px; border:1px solid #ccc; border-radius: 10px; background:#fff; cursor:pointer; }
button.primary { background:#111; color:#fff; border-color:#111; }
button:disabled { opacity: .5; cursor:not-allowed; }
table { width:100%; border-collapse: collapse; margin-top: 8px; }
th, td { border-bottom: 1px solid #eee; padding: 10px; text-align:left; }
th { background:#fafafa; }
.error { color:#b00020; white-space: pre-wrap; margin-top: 10px; }
.ok { color:#0a7a2f; white-space: pre-wrap; margin-top: 10px; }
a.disabled { pointer-events:none; color:#999; text-decoration:none; }
.pill { display:inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; border:1px solid #ddd; }
.topline { display:flex; flex-direction:column; gap:6px; }

.spinner { display:inline-block; width:14px; height:14px; border:2px solid #ccc; border-top-color:#111; border-radius:50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

:root { --batch-size: 150px; }

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--batch-size), var(--batch-size)));
  gap: 12px;
  margin-top: 8px;
  align-items: start;
}
.batch-item { text-align: center; }
.batch-item button.batch-btn {
  all: unset;
  cursor: pointer;
  display: inline-block;
}
.batch-item img {
  width: var(--batch-size);
  height: var(--batch-size);
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  display: block;
}
.batch-caption { margin-top: 6px; font-size: 12px; color: #666; max-width: var(--batch-size); }

/* ---------- Auth UI ---------- */
.auth-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-tabs .tab {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 13px;
}
.auth-tabs .tab.active {
  background: #111;
  color: #fff;
  border-color: #111;
}
.auth-panel { margin-top: 6px; }
.mini-hint { font-size: 12px; margin-top: 8px; }
.divider { height: 1px; background: #eee; margin: 14px 0; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}
.modal.open { display: flex; }
.modal-content {
  max-width: min(920px, 95vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.modal-header {
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}
.modal-title { font-size: 14px; color:#333; }
.modal-close {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.modal-body {
  padding: 12px;
  background: #fff;
  display:flex;
  justify-content:center;
  align-items:center;
}
.modal-body img {
  max-width: 100%;
  max-height: calc(90vh - 70px);
  width: auto;
  height: auto;
  display:block;
}

/* ---------- Header / Footer ---------- */
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo {
  height: 75px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
}

.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.footer-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.copyright {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin: 0;
  line-height: 1;
}

.feda-logo {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.footer-right {
  display: flex;
  justify-content: flex-end;
}

.qdai-logo {
  height: 90px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 600px) {
  body { margin: 14px; }
  input { min-width: 220px; }
  :root { --batch-size: 110px; }
  h1 { font-size: 22px; }

  .site-footer {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .footer-right { justify-content: center; }
}