/* ==========================================================
   出荷ノート - 農家向け出荷・売上管理アプリ
   モバイルファースト / 大きな文字とボタン / 緑系配色
   ========================================================== */

:root {
  --green-900: #1b4332;
  --green-800: #2d6a4f;
  --green-700: #40916c;
  --green-600: #52b788;
  --green-500: #74c69d;
  --green-100: #d8f3dc;
  --green-50: #f1faf4;
  --orange-600: #e07a19;
  --orange-100: #ffe8cc;
  --red-600: #d64545;
  --red-100: #fde2e2;
  --text-main: #23342b;
  --text-sub: #5c6f64;
  --bg-body: #f4f9f4;
  --card-bg: #ffffff;
  --shadow: 0 2px 10px rgba(27, 67, 50, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 88px; /* space for bottom nav */
  font-size: 16px;
  line-height: 1.5;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
}

/* ---------- ヘッダー ---------- */
.app-header {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  color: #fff;
  padding: 18px 20px 20px;
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow);
}

.app-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header__date {
  margin-top: 8px;
  font-size: 15px;
  opacity: 0.92;
  font-weight: 600;
}

.header-icon-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- メインコンテンツ ---------- */
.page {
  padding: 16px;
  flex: 1;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card__title {
  font-size: 17px;
  font-weight: 800;
  color: var(--green-900);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__title .fa-solid, .card__title .fa-regular {
  color: var(--green-600);
}

/* ---------- フォーム要素 ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 14px 14px;
  font-size: 18px;
  border: 2px solid var(--green-100);
  border-radius: 12px;
  background: var(--green-50);
  color: var(--text-main);
  font-weight: 700;
  appearance: none;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--green-600);
  background: #fff;
}

.form-input--date {
  font-weight: 700;
}

.qty-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 12px;
  border: 2px solid var(--green-100);
  background: var(--green-50);
  color: var(--green-800);
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:active {
  background: var(--green-100);
}

.qty-input-row .form-input {
  text-align: center;
  font-size: 22px;
}

.unit-suffix-wrap {
  position: relative;
}

.unit-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  pointer-events: none;
}

/* ---------- 品目クイック選択 ---------- */
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.item-chip {
  border: 2px solid var(--green-100);
  background: var(--green-50);
  border-radius: 14px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-main);
  font-size: 14px;
  min-height: 76px;
  justify-content: center;
}

.item-chip__emoji {
  font-size: 26px;
  line-height: 1;
}

.item-chip.selected {
  border-color: var(--green-700);
  background: var(--green-600);
  color: #fff;
  box-shadow: 0 4px 10px rgba(64,145,108,0.35);
}

.item-chip.add-new {
  border-style: dashed;
  color: var(--green-700);
}

/* ---------- ボタン ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: #fff;
  box-shadow: 0 4px 12px rgba(45,106,79,0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--green-50);
  color: var(--green-800);
  border: 2px solid var(--green-100);
}

.btn-outline-danger {
  background: var(--red-100);
  color: var(--red-600);
}

.btn-sm {
  padding: 10px 14px;
  font-size: 14px;
  width: auto;
  border-radius: 10px;
}

.btn-block-row {
  display: flex;
  gap: 10px;
}
.btn-block-row .btn { flex: 1; }

/* ---------- 出荷リスト / 実績リスト ---------- */
.shipment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shipment-item {
  border: 2px solid var(--green-100);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--green-50);
}

.shipment-item.status-done {
  border-color: var(--green-500);
  background: #fff;
}

.shipment-item.status-pending {
  border-color: var(--orange-100);
  background: #fffaf3;
}

.shipment-item__emoji {
  font-size: 30px;
  width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.shipment-item__body {
  flex: 1;
  min-width: 0;
}

.shipment-item__name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.shipment-item__meta {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 2px;
}

.shipment-item__amount {
  font-weight: 900;
  font-size: 16px;
  color: var(--green-800);
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge-pending {
  background: var(--orange-100);
  color: var(--orange-600);
}

.badge-done {
  background: var(--green-100);
  color: var(--green-800);
}

.shipment-item__delete {
  background: none;
  border: none;
  color: #b6c4bb;
  font-size: 18px;
  padding: 6px;
  flex-shrink: 0;
}

/* ---------- 実績入力パネル (アコーディオン風) ---------- */
.result-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed var(--green-100);
}

.mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-toggle button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--green-100);
  background: #fff;
  font-weight: 700;
  color: var(--text-sub);
  font-size: 13px;
}

.mode-toggle button.active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}

.calc-preview {
  background: var(--green-100);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  margin: 10px 0;
  font-weight: 800;
  color: var(--green-900);
  font-size: 15px;
}

.calc-preview .amount {
  font-size: 24px;
  color: var(--green-800);
}

/* ---------- ダッシュボード ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: #fff;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

.stat-box.alt {
  background: linear-gradient(135deg, var(--orange-600), #f0a04b);
}

.stat-box__label {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 700;
}

.stat-box__value {
  font-size: 24px;
  font-weight: 900;
  margin-top: 4px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--green-50);
}

.rank-item__no {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-item__no.rank-1 { background: #e0a800; }
.rank-item__no.rank-2 { background: #9aa5b1; }
.rank-item__no.rank-3 { background: #b08968; }

.rank-item__name {
  flex: 1;
  font-weight: 700;
}

.rank-item__value {
  font-weight: 900;
  color: var(--green-800);
}

.rank-bar-track {
  height: 6px;
  border-radius: 4px;
  background: var(--green-100);
  margin-top: 4px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  background: var(--green-600);
}

.month-select-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.month-select-row button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--green-100);
  background: #fff;
  font-size: 16px;
  color: var(--green-800);
}

.month-select-row .month-label {
  font-size: 17px;
  font-weight: 800;
  color: var(--green-900);
  min-width: 110px;
  text-align: center;
}

/* ---------- 品目設定 ---------- */
.item-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--green-50);
}

.item-manage-row__emoji {
  font-size: 22px;
  width: 32px;
  text-align: center;
}

.item-manage-row__name {
  flex: 1;
  font-weight: 700;
}

.item-manage-row__del {
  background: none;
  border: none;
  color: var(--red-600);
  font-size: 16px;
  padding: 6px;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.emoji-picker button {
  font-size: 22px;
  padding: 8px 0;
  border-radius: 10px;
  border: 2px solid var(--green-100);
  background: var(--green-50);
}

.emoji-picker button.selected {
  border-color: var(--green-700);
  background: var(--green-100);
}

/* ---------- 空状態 ---------- */
.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-sub);
}

.empty-state .fa-solid {
  font-size: 40px;
  color: var(--green-100);
  margin-bottom: 10px;
}

/* ---------- 下部タブナビ ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e6efe8;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 -2px 14px rgba(0,0,0,0.06);
  z-index: 50;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 0 10px;
  color: var(--text-sub);
  background: none;
  border: none;
  font-weight: 700;
  font-size: 11px;
}

.bottom-nav__item .fa-solid {
  font-size: 19px;
}

.bottom-nav__item.active {
  color: var(--green-700);
}

/* ---------- トースト（保存確認） ---------- */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-900);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast .fa-solid {
  color: var(--green-500);
}

/* ---------- モーダル ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,40,30,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal-sheet {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px 26px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-sheet__title {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-900);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: var(--green-50);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--text-sub);
}

/* ---------- ユーティリティ ---------- */
.text-center { text-align: center; }
.text-sub { color: var(--text-sub); font-size: 13px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.hidden { display: none !important; }

@media (min-width: 560px) {
  body { padding-bottom: 0; }
  .bottom-nav { position: static; box-shadow: none; border-radius: 0 0 16px 16px; margin-bottom: 20px; }
  #app { box-shadow: var(--shadow); background: var(--bg-body); }
}
