/* ===== melon PC版 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --green: #43a047;
  --green-d: #2e7d32;
  --green-l: #e8f5e9;
  --gray: #6b7280;
  --gray-l: #f3f4f6;
  --red: #e53935;
  --amber: #f59e0b;
  --border: #e5e7eb;
}
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #f5f6f8; color: #1f2937; height: 100%;
}

/* ログイン */
.login-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  display: flex; flex-direction: column; gap: 14px; width: 340px;
  background: #fff; padding: 40px 32px; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-logo { font-size: 34px; font-weight: 800; text-align: center; color: var(--green-d); }
.login-sub { text-align: center; color: var(--gray); margin-bottom: 8px; }
.login-box input { height: 46px; padding: 0 14px; font-size: 15px; border: 1px solid var(--border); border-radius: 10px; }
.login-note { font-size: 12px; color: var(--gray); text-align: center; }

/* レイアウト */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #1f2937; color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-logo { font-size: 22px; font-weight: 800; padding: 20px; color: #fff; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.nav-item { padding: 12px 16px; border-radius: 8px; cursor: pointer; color: #d1d5db; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active { background: var(--green); color: #fff; font-weight: 700; }
.side-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.side-logout { color: #fca5a5; cursor: pointer; }
.side-logout:hover { text-decoration: underline; }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.page { display: none; }
.page.active { display: block; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.head-actions { display: flex; gap: 10px; align-items: center; }

/* ボタン */
.btn { border: none; border-radius: 8px; font-size: 14px; font-weight: 600; height: 40px; padding: 0 18px; cursor: pointer; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-d); }
.btn-secondary { background: #fff; color: var(--green-d); border: 1.5px solid var(--green); }
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn-mini { border: none; border-radius: 6px; font-size: 12px; height: 28px; padding: 0 10px; cursor: pointer; color: #fff; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.search { height: 40px; padding: 0 14px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; min-width: 180px; }

/* カード */
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin-bottom: 18px; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.muted { color: var(--gray); font-size: 13px; margin: 6px 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--gray); }
.field input { height: 42px; padding: 0 12px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.sync-result { margin-top: 14px; }
.sync-ok { color: var(--green-d); font-weight: 700; padding: 12px 16px; background: var(--green-l); border-radius: 8px; }
.sync-err { color: var(--red); padding: 12px 16px; background: #fef2f2; border-radius: 8px; }

/* ページャ */
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--gray); }
.pg-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 16px; }
.pg-btn:disabled { opacity: 0.4; cursor: default; }
.pg-cur { font-weight: 600; color: #1f2937; }

/* モーダル */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 14px; width: 460px; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--gray); line-height: 1; }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-head, .modal-foot { flex-shrink: 0; }
.modal-foot { display: flex; justify-content: space-between; padding: 16px 22px; border-top: 1px solid var(--border); }

/* トースト・ローディング */
#toastContainer { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 20px; border-radius: 22px; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.5); z-index: 9998; align-items: center; justify-content: center; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* スキャン入力ページ */
.scan-input-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 720px; }
.scan-input-row { display: flex; gap: 12px; margin: 14px 0; }
.scan-input-row input { flex: 1; height: 56px; font-size: 22px; padding: 0 16px; border: 2px solid var(--green); border-radius: 10px; }
.scan-input-row .btn { height: 56px; font-size: 16px; padding: 0 28px; }
.scan-result-area { margin-top: 16px; }
.scan-card { border: 2px solid var(--green); background: var(--green-l); border-radius: 12px; padding: 18px 20px; }
.scan-card.scan-card-low { border-color: var(--amber); background: #fff7ed; }
.scan-card.scan-card-err { border-color: var(--red); background: #fef2f2; }
.scc-name { font-size: 22px; font-weight: 800; }
.scc-maker { color: var(--gray); font-size: 13px; margin-top: 2px; }
.scc-stock { font-size: 16px; margin-top: 8px; }
.scc-stock b { font-size: 30px; color: var(--green-d); }
.scc-alert { color: var(--amber); font-weight: 700; margin-top: 6px; }
.scc-note { color: var(--red); font-size: 13px; margin-top: 6px; }
.scan-log { margin-top: 20px; max-width: 720px; }
.scan-log-title { font-size: 13px; font-weight: 700; color: var(--gray); margin-bottom: 6px; }
.scan-log-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.sl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-jan { font-family: monospace; color: #9ca3af; font-size: 12px; }
.sl-stock { color: var(--green-d); font-weight: 700; width: 60px; text-align: right; }
.sl-time { color: var(--gray); font-size: 12px; width: 44px; text-align: right; }
