/* キッチン八福神 受注管理システム 共通スタイル
   仕様書 3.：タブレット・PC対応のレスポンシブ。厨房・配送現場での操作を想定し、
   タップ領域は44px以上、文字は大きめ、主要操作は画面上部に固定。 */

:root {
  --navy: #1f2a44;
  --navy-light: #2f3d5f;
  --gold: #b8860b;
  --gold-light: #d9a441;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dfe3ea;
  --text: #1b2130;
  --muted: #6b7280;
  --ok: #1f7a4d;
  --warn: #b26a00;
  --error: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 28, 48, 0.08), 0 4px 16px rgba(20, 28, 48, 0.06);
  --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--navy); }

/* ---- ヘッダー・ナビ ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy);
  color: #fff;
}
.app-header__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: 1400px;
  margin: 0 auto;
}
.app-header__brand { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; }
.app-header__brand small { display: block; font-weight: 400; font-size: 0.72rem; color: #c9d0e0; }
.app-header__spacer { flex: 1; }
.app-header__user { font-size: 0.85rem; color: #e4e8f2; }
.app-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 8px;
  background: var(--navy-light);
  scrollbar-width: thin;
}
.app-nav a {
  flex: 0 0 auto;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #dfe4f0;
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.app-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--gold-light); background: rgba(255,255,255,0.08); }

/* ---- レイアウト ---- */
.page { max-width: 1400px; margin: 0 auto; padding: 16px; }
.page-title { margin: 4px 0 16px; font-size: 1.3rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title .sub { font-size: 0.85rem; color: var(--muted); font-weight: 400; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}
.toolbar .field { display: flex; flex-direction: column; gap: 4px; }
.toolbar .field > label { font-size: 0.75rem; color: var(--muted); }
.toolbar .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 1rem; }
.card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card__head h2 { margin: 0; flex: 1; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__label { font-size: 0.78rem; color: var(--muted); }
.stat__value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 0.78rem; color: var(--muted); }

/* ---- フォーム ---- */
input, select, textarea, button { font: inherit; }
input[type="text"], input[type="date"], input[type="number"], input[type="email"],
input[type="password"], input[type="time"], select, textarea {
  min-height: var(--tap);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-light); outline-offset: 1px; }
textarea { min-height: 80px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); }

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}
.btn:hover { background: var(--navy-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: #fff; color: var(--navy); }
.btn--ghost:hover { background: #eef1f7; }
.btn--gold { background: var(--gold); border-color: var(--gold); }
.btn--gold:hover { background: var(--gold-light); }
.btn--danger { background: var(--error); border-color: var(--error); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }

/* ---- テーブル ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data thead th { background: #eef1f7; font-size: 0.8rem; color: var(--muted); position: sticky; top: 0; z-index: 1; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: #fafbfd; }
table.data tr.is-alert td { background: #fdf2f2; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: #eef1f7;
  white-space: nowrap;
}
.badge--ok { background: #e7f5ee; border-color: #b8e0cb; color: var(--ok); }
.badge--warn { background: #fdf3e2; border-color: #f0d9a8; color: var(--warn); }
.badge--error { background: #fdecea; border-color: #f3c0bb; color: var(--error); }
.badge--muted { color: var(--muted); }

.progress { height: 8px; background: #e7eaf1; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border: 1px solid; font-size: 0.92rem; }
.alert--warn { background: #fdf3e2; border-color: #f0d9a8; color: #8a5200; }
.alert--error { background: #fdecea; border-color: #f3c0bb; color: #8c1d18; }
.alert--info { background: #eaf1fb; border-color: #bed2f0; color: #17427e; }

.empty { padding: 32px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

/* ---- モーダル ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 22, 38, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto; z-index: 100;
}
.modal {
  background: var(--surface); border-radius: var(--radius); width: min(880px, 100%);
  box-shadow: 0 12px 48px rgba(0,0,0,0.25); padding: 20px;
}
.modal h2 { margin-top: 0; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ---- トースト ---- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); font-size: 0.92rem; }
.toast--error { background: var(--error); }
.toast--ok { background: var(--ok); }
.toast--warn { background: var(--warn); }

/* ---- 商品写真 ---- */
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.thumb--empty { display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 0.8rem; }
.image-field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.image-field__preview { max-width: 240px; max-height: 180px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 8px; }

/* ---- チェックボックス付きラベル ---- */
.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 0.92rem; cursor: pointer; }
.check input[type="checkbox"] { width: 20px; height: 20px; min-height: auto; flex: none; }

/* ---- ログイン ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    linear-gradient(rgba(31, 42, 68, 0.88), rgba(31, 42, 68, 0.88)),
    url('/assets/img/bento-hero.jpg') center / cover no-repeat;
  background-color: var(--navy);
}
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: min(420px, 100%); box-shadow: 0 16px 48px rgba(0,0,0,0.3); }
.login-card h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 0.85rem; }
.login-card .field { margin-bottom: 14px; }
.login-card label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }

/* ---- レスポンシブ（タブレット・スマホ） ---- */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .page { padding: 12px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .toolbar { padding: 10px; }
  .toolbar .field { flex: 1 1 140px; }
  .app-header__brand small { display: none; }
  table.data { font-size: 0.86rem; }
}

/* ---- 印刷（製造指示書・配送リスト・請求書） ---- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .app-header, .app-nav, .toolbar, .no-print, #toast-root { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; page-break-inside: avoid; }
  table.data { font-size: 10pt; }
  table.data thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
  .page-break { page-break-before: always; }
}
.print-only { display: none; }
