/* ============================================================
   お米発注システム 共通スタイル
   ============================================================ */
:root {
  --green:       #2d6a4f;
  --green-mid:   #40916c;
  --green-light: #52b788;
  --green-pale:  #d8f3dc;
  --amber:       #e9c46a;
  --amber-dark:  #f4a261;
  --red:         #ef4444;
  --gray-dark:   #374151;
  --gray:        #6b7280;
  --gray-light:  #f3f4f6;
  --border:      #e5e7eb;
  --text:        #1f2937;
  --white:       #ffffff;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.08);
  --shadow:      0 4px 20px rgba(0,0,0,0.10);
  --radius:      10px;
  --radius-sm:   6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  background: #f0f4f0;
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── ヘッダー ── */
.header {
  background: var(--green);
  color: var(--white);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky; top: 0; z-index: 100;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px;
}
.header-logo span { font-size: 22px; }
.header-nav { display: flex; align-items: center; gap: 16px; }
.header-nav a { color: rgba(255,255,255,0.85); font-size: 14px; }
.header-nav a:hover { color: white; text-decoration: none; }
.header-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: rgba(255,255,255,0.9);
}
.role-chip {
  background: rgba(255,255,255,0.2);
  padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700;
}

/* ── レイアウト ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px;
}
.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ── カード ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--green-pale);
}
.card-title {
  font-size: 17px; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}

/* ── ページタイトル ── */
.page-title {
  font-size: 22px; font-weight: 800;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.page-title small {
  font-size: 13px; font-weight: 400; color: var(--gray);
}

/* ── フォーム ── */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px; font-weight: 700;
  margin-bottom: 6px;
  color: var(--gray-dark);
}
.form-label .required {
  color: var(--red); margin-left: 4px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.15);
}
.form-control::placeholder { color: #b0bec5; }
select.form-control { cursor: pointer; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  font-family: inherit;
  cursor: pointer; border: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--green); color: white;
}
.btn-primary:hover { background: var(--green-mid); text-decoration: none; color: white; }
.btn-secondary {
  background: var(--gray-light); color: var(--gray-dark);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); text-decoration: none; }
.btn-amber {
  background: var(--amber); color: var(--gray-dark);
}
.btn-amber:hover { background: var(--amber-dark); text-decoration: none; }
.btn-danger {
  background: #fee2e2; color: var(--red);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fecaca; text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── テーブル ── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th {
  background: var(--green);
  color: white;
  padding: 10px 14px;
  text-align: left; font-weight: 700;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.data-table tbody tr:nth-child(even) td { background: #fafafa; }
.data-table tbody tr:nth-child(even):hover td { background: #f3f4f6; }

/* ── ステータスバッジ ── */
.badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-shipped  { background: #dcfce7; color: #166534; }
.badge-delivered{ background: #d1fae5; color: #065f46; }
.badge-cancelled{ background: #fee2e2; color: #991b1b; }

/* ── アラート ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--red); }
.alert-success { background: var(--green-pale); color: #166534; border-left: 4px solid var(--green-light); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #60a5fa; }
.alert-warn    { background: #fef9c3; color: #854d0e; border-left: 4px solid var(--amber); }

/* ── 統計カード ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-card .stat-label {
  font-size: 12px; color: var(--gray); font-weight: 600;
}
.stat-card .stat-value {
  font-size: 26px; font-weight: 800; color: var(--green);
}
.stat-card .stat-sub {
  font-size: 12px; color: var(--gray);
}

/* ── ログイン画面 ── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .logo-icon { font-size: 48px; }
.login-logo h1 { font-size: 20px; font-weight: 800; color: var(--green); margin-top: 8px; }
.login-logo p { font-size: 13px; color: var(--gray); margin-top: 4px; }
.login-divider {
  text-align: center; font-size: 13px; color: var(--gray);
  margin: 16px 0; position: relative;
}
.login-divider::before, .login-divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px;
  background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after { right: 0; }

/* ── 空状態 ── */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--gray);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── モーダル ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white; border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 800; }
.modal-close {
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--gray); line-height: 1;
  padding: 0 4px;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── ローディング ── */
.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px; color: var(--gray);
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--green-pale);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── レスポンシブ ── */
@media (max-width: 640px) {
  .container { padding: 16px 14px; }
  .card { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header-logo span { font-size: 18px; }
  .hide-sp { display: none; }
}
