:root {
  --red: #c81e1e;
  --navy: #1b2340;
  --link: #1a56db;
  --line: #e2e5ec;
  --zebra: #f2f6fb;
  --muted: #666f80;
  --bg: #ffffff;
  --page-bg: #f7f8fb;
  --good: #1a7a3c;
  --bad: #c81e1e;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--page-bg);
  color: #222;
  line-height: 1.65;
  font-size: 14px;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

.demo-strip {
  background: #fff3cd; color: #7a5300; font-size: 12px; text-align: center; padding: 6px 10px;
  border-bottom: 1px solid #f0dfa0;
}

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 2px solid var(--navy); }
.head-row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-size: 20px; font-weight: 900; color: var(--red); letter-spacing: 0.01em; }
.logo span { color: #222; }
.head-nav a { font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; border-radius: 4px; }
.head-nav a:hover { background: #f5f6f9; text-decoration: none; }

.crumb {
  max-width: 880px; margin: 0 auto; padding: 8px 16px; font-size: 12px; color: var(--muted);
}
.crumb a { color: var(--link); }
.crumb .sep { margin: 0 6px; color: #bbb; }

/* ---------- Home ---------- */
.page-title { text-align: center; font-size: 24px; font-weight: 900; margin: 26px 0 20px; color: #222; }
.update-box {
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  max-width: 560px; margin: 0 auto 22px; padding: 14px 18px;
}
.update-box .cap { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.update-box ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.update-box li { padding: 3px 0; }
.update-box li a { color: var(--link); }
.update-box li .d { color: var(--muted); font-size: 11.5px; margin-left: 4px; }

.search-panel {
  max-width: 560px; margin: 0 auto 26px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 16px 18px;
}
.search-panel .cap { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.search-row { display: flex; gap: 8px; flex-wrap: wrap; }
.search-row select, .search-row input[type="text"] {
  flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 13.5px;
}
.search-row button {
  background: var(--navy); color: #fff; border: none; padding: 9px 18px; border-radius: 4px;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.search-row button:hover { background: #0f1530; }
.search-result { margin-top: 12px; font-size: 12.5px; }
.search-result a { display: inline-block; margin: 3px 8px 3px 0; }

.section-divider {
  border: none; border-top: 2px solid var(--navy); margin: 26px 0 14px;
}
.section-cap { text-align: center; font-size: 17px; font-weight: 800; margin-bottom: 16px; }

.region-block { max-width: 720px; margin: 0 auto 18px; text-align: center; }
.region-block h3 { font-size: 14px; font-weight: 800; margin: 0 0 6px; color: var(--navy); }
.pref-links a { margin: 0 8px; font-size: 13.5px; display: inline-block; }
.pref-links .empty { color: #b7bcc8; }

/* ---------- Tables (shared) ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.plain { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.plain caption { text-align: left; font-weight: 800; padding: 4px 0; }
table.plain th, table.plain td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.plain th { background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 700; }
table.plain tbody tr:nth-child(even) { background: var(--zebra); }
table.plain td.wrap-cell { white-space: normal; }
table.plain a { font-weight: 600; }

.info-table { width: 100%; max-width: 640px; margin: 0 auto 20px; border-collapse: collapse; font-size: 13.5px; }
.info-table th, .info-table td { border: 1px solid var(--line); padding: 10px 14px; }
.info-table th { background: var(--navy); color: #fff; width: 34%; text-align: left; font-weight: 700; font-size: 12.5px; }
.info-table td { background: #fff; }
.info-table td.hl-good { color: var(--good); font-weight: 800; }
.info-table td.hl-bad { color: var(--bad); font-weight: 800; }

/* ---------- Hall (area) list page ---------- */
.area-title { text-align: center; font-size: 20px; font-weight: 900; margin: 22px 0 16px; }
.area-search { max-width: 640px; margin: 0 auto 16px; }
.area-search input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; font-size: 13.5px;
}
.hall-table-wrap { max-width: 640px; margin: 0 auto 30px; }

/* ---------- Store detail ---------- */
.store-title { text-align: center; font-size: 22px; font-weight: 900; margin: 22px 0 14px; }
.info-cap { text-align: center; font-size: 15px; font-weight: 800; margin: 0 0 10px; }
.machine-list-wrap { max-width: 640px; margin: 0 auto 30px; }
.machine-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.machine-list li { border-bottom: 1px solid var(--line); padding: 11px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.machine-list li:last-child { border-bottom: none; }
.machine-list a { font-size: 14px; font-weight: 700; }
.machine-list .cnt { font-size: 12px; color: var(--muted); flex: none; white-space: nowrap; }
.machine-list .hot { color: var(--bad); font-weight: 800; font-size: 11.5px; margin-left: 6px; }
.filter-row { max-width: 640px; margin: 0 auto 14px; display: flex; gap: 8px; }
.filter-row input, .filter-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.filter-row input { flex: 1; }

/* ---------- Data detail ---------- */
.data-title { text-align: center; margin: 20px 0 6px; }
.data-title h1 { font-size: 19px; margin: 0; }
.data-title p { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.rank-box {
  max-width: 640px; margin: 14px auto; background: #fff8e6; border: 1px solid #f0d68a;
  border-radius: 6px; padding: 10px 16px; text-align: center; font-size: 13.5px;
}
.rank-box b { color: #8a6300; font-size: 16px; }
.unit-table-wrap { max-width: 640px; margin: 0 auto 30px; }
.unit-table-wrap td.today-val { font-weight: 800; color: var(--navy); }
.unit-table-wrap tr.is-top td { background: #fff8e6 !important; }
.unit-table-wrap tr.is-top td:first-child { font-weight: 800; }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 20px 16px 60px; color: var(--muted); font-size: 11.5px; }
.site-footer p { margin: 4px 0; }
.site-footer .powered { color: #aab0bd; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 13px; }

/* ---------- Admin ---------- */
.admin-body { background: #eef0f6; font-size: 14px; }
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-topbar {
  background: var(--navy); color: #fff; padding: 14px 20px; display: flex;
  align-items: center; justify-content: space-between;
}
.admin-topbar .who { font-size: 12px; color: #cfd3ec; }
.admin-topbar .who a { color: #cfd3ec; }
.admin-grid { display: grid; gap: 18px; margin-top: 18px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 1.1fr 0.9fr; } }
.panel { background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(20,20,40,0.06); padding: 18px 20px; }
.panel h3 { margin: 0 0 4px; font-size: 15px; }
.panel .hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.form-row select, .form-row input[type="date"], .form-row input[type="text"] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
}
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab-btn { flex: 1; padding: 8px 0; border-radius: 6px; border: 1px solid var(--line); background: #fbfbfd; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
textarea.data-input {
  width: 100%; min-height: 150px; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; font-size: 12.5px; font-family: "SF Mono", Consolas, monospace; resize: vertical;
}
.file-drop { border: 1.5px dashed var(--line); border-radius: 6px; padding: 18px; text-align: center; font-size: 12.5px; color: var(--muted); background: #fbfbfd; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-box { background: #fbfbfd; border: 1px solid var(--line); border-radius: 6px; padding: 10px; text-align: center; }
.stat-box .n { font-size: 19px; font-weight: 900; color: var(--navy); }
.stat-box .l { font-size: 10.5px; color: var(--muted); }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
.preview-table th, .preview-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.preview-table tr.row-error td { color: var(--bad); background: #fff5f5; }
.log-list { font-size: 12px; list-style: none; margin: 0; padding: 0; }
.log-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.log-list li:last-child { border-bottom: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 6px; padding: 10px 16px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:disabled { background: #b9bfd0; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: #222; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 100px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 100; opacity: 0;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 20px; }
.login-card { background: #fff; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.25); padding: 30px 26px; width: 100%; max-width: 340px; text-align: center; }
.login-card .logo2 { font-weight: 900; font-size: 17px; color: var(--navy); margin-bottom: 4px; }
.login-card .sub { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.login-card .form-row { text-align: left; }
.login-note { margin-top: 12px; font-size: 11px; color: var(--muted); }
.login-card button.btn { width: 100%; }

@media (max-width: 480px) {
  .search-row { flex-direction: column; }
  .machine-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
}
