/* ============ コレアル 共通スタイル ============ */
:root {
  --blue: #1e5eff;
  --blue-dark: #1747c2;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #67728a;
  --border: #dfe4ee;
  --green: #0f9d58;
  --green-bg: #e6f6ee;
  --amber: #b26a00;
  --amber-bg: #fff3e0;
  --red: #d93025;
  --red-bg: #fdecea;
  --gray: #5f6b7f;
  --gray-bg: #eef1f6;
  --purple: #7b3ff2;
  --purple-bg: #f1eafe;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 1px 2px rgba(20, 30, 60, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", Meiryo, system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(30, 94, 255, .35); border-color: var(--blue); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }

/* ---- ヘッダー ---- */
header {
  background: #0f1c3f; color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 8px; height: 54px;
}
.logo { font-size: 19px; font-weight: 700; letter-spacing: .05em; color: #fff; display: flex; align-items: center; gap: 7px; }
.logo:hover { text-decoration: none; }
.logo small { font-size: 10.5px; font-weight: 400; opacity: .75; letter-spacing: 0; }
nav { display: flex; gap: 2px; margin-left: 18px; flex: 1; overflow-x: auto; }
nav a {
  color: #c6d2f0; padding: 6px 13px; border-radius: 7px; font-size: 13.5px; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
nav a.active { background: var(--blue); color: #fff; }
.nav-badge {
  background: var(--red); color: #fff; font-size: 10.5px; border-radius: 9px;
  padding: 0 6px; min-width: 17px; text-align: center; line-height: 17px;
}
.user-chip { color: #c6d2f0; font-size: 12.5px; white-space: nowrap; }
.btn-logout {
  background: none; border: 1px solid rgba(255,255,255,.3); color: #c6d2f0;
  border-radius: 7px; padding: 4px 10px; font-size: 12px; margin-left: 8px;
}
.btn-logout:hover { background: rgba(255,255,255,.1); }

/* ---- レイアウト ---- */
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-head h1 { font-size: 21px; }
.page-sub { color: var(--muted); font-size: 12.5px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h2 { font-size: 15.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn.secondary:hover { background: var(--gray-bg); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #f2b8b5; font-weight: 500; }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

/* ---- ステータスバッジ ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 2px 10px; white-space: nowrap;
}
.badge.in_stock { background: var(--green-bg); color: var(--green); }
.badge.low_stock { background: var(--amber-bg); color: var(--amber); }
.badge.out_of_stock { background: var(--red-bg); color: var(--red); }
.badge.backorder { background: #e3f0fd; color: #1565c0; }
.badge.preorder { background: var(--purple-bg); color: var(--purple); }
.badge.discontinued { background: var(--gray-bg); color: var(--gray); }
.badge.unknown { background: var(--gray-bg); color: var(--gray); }
.badge.error { background: var(--red-bg); color: var(--red); border: 1px dashed var(--red); }
.badge.paused { background: var(--gray-bg); color: var(--gray); }

/* ---- 統計カード ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 15px;
}
.stat .num { font-size: 25px; font-weight: 700; line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--muted); }
.stat.green .num { color: var(--green); }
.stat.red .num { color: var(--red); }
.stat.amber .num { color: var(--amber); }

/* ---- テーブル ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th {
  text-align: left; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8faff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.small-muted { font-size: 11.5px; color: var(--muted); }

/* ---- フォーム ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.error-msg { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; }
.warn-msg { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; }
.ok-msg { background: var(--green-bg); color: var(--green); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; }

/* ---- ログイン ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); border-radius: 14px; box-shadow: 0 8px 30px rgba(15,28,63,.12); padding: 32px 30px; width: 100%; max-width: 400px; }
.auth-logo { text-align: center; font-size: 27px; font-weight: 700; color: #0f1c3f; margin-bottom: 2px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }

/* ---- 通知 ---- */
.notif { display: flex; gap: 10px; padding: 12px 6px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif:last-child { border-bottom: none; }
.notif.unread { background: #f2f7ff; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 8px; flex-shrink: 0; }
.notif.read .dot { background: transparent; }
.notif .t { font-weight: 600; font-size: 13.5px; }
.notif .b { color: var(--muted); font-size: 12.5px; }

/* ---- 検索バー ---- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input[type="search"] { max-width: 260px; }
.toolbar select { width: auto; }

/* ---- 免責 ---- */
footer {
  max-width: 1180px; margin: 0 auto; padding: 14px 16px 30px;
  color: var(--muted); font-size: 11.5px; line-height: 1.7;
}
.disclaimer {
  background: #fffbe8; border: 1px solid #f0e2a0; border-radius: 8px; padding: 10px 14px;
}

/* ---- モーダル ---- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,28,63,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 14px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 640px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal h2 { font-size: 17px; margin-bottom: 8px; }

/* ---- 履歴グラフ ---- */
.chart-box { overflow-x: auto; }
.chart-box svg { display: block; }

/* ---- スピナー ---- */
.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px;
}
.spinner.dark { border-color: rgba(30,94,255,.25); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- 取得プレビュー ---- */
.preview-check { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; margin: 8px 0; }
.preview-check .ok::before { content: "✓ "; color: var(--green); font-weight: 700; }
.preview-check .ng::before { content: "✕ "; color: var(--red); font-weight: 700; }

/* ---- モバイル ---- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .header-inner { height: auto; flex-wrap: wrap; padding: 8px 12px; }
  nav { order: 3; width: 100%; margin-left: 0; }
  .user-chip { display: none; }
  main { padding: 14px 10px 50px; }
  .card { padding: 14px; }
  th, td { padding: 8px 7px; }
  .btn { padding: 10px 14px; }
}
