/* GG農場 管理（スマホのアプリと同じ緑） */
:root {
  --green: #3e7d3a;
  --green-dark: #2e5e2b;
  --green-soft: #e3efe0;
  --bg: #f6f8f4;
  --card: #ffffff;
  --line: #d9dfd5;
  --text: #1d241b;
  --muted: #6b7568;
  --error: #b3261e;
  --ok: #2e6b55;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; }
[hidden] { display: none !important; }

.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.narrow { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.logo { font-size: 40px; text-align: center; }
h1 { font-size: 22px; text-align: center; margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 20px; margin: 0; font-weight: 600; }
h3 { font-size: 18px; margin: 0 0 12px; font-weight: 600; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select {
  font: inherit; font-size: 15px; color: var(--text);
  padding: 10px 12px; border: 1px solid #b9c2b4; border-radius: 6px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.pw { position: relative; display: flex; }
.pw input { flex: 1; padding-right: 42px; }
.pw .pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); line-height: 0; }
label.radio { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.radio input { width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }

button {
  font: inherit; font-size: 14px; cursor: pointer;
  padding: 8px 14px; border-radius: 20px; border: 1px solid #b9c2b4; background: #fff; color: var(--text);
}
button:hover { background: #f0f3ee; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--green); border-color: var(--green); color: #fff; }
button.primary:hover { background: var(--green-dark); }
button.link { border: none; background: none; color: var(--green); padding: 4px; }
button.icon { border: none; background: none; padding: 4px 6px; border-radius: 6px; }
button.icon:hover { background: var(--green-soft); }

.error { color: var(--error); font-size: 13px; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.muted { color: var(--muted); }

/* 管理画面 */
#shell { display: flex; flex-direction: column; min-height: 100vh; }
/* メニューは画面の上に横並び（1.21.1〜）。入りきらなければ折り返す */
.side {
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: row; align-items: center; padding: 6px 12px; gap: 4px;
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { font-size: 14px; color: var(--green); font-weight: 600; white-space: nowrap; margin-right: 12px; }
.nav { display: flex; flex-direction: row; align-items: center; gap: 4px; border: none; border-radius: 10px; font-size: 16px; padding: 6px 10px; white-space: nowrap; flex-shrink: 0; }
.nav span { font-size: 13px; }
.nav.active { background: var(--green-soft); color: var(--green-dark); }
.me { margin-left: auto; padding-left: 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }

.page { flex: 1; padding: 20px 24px; min-width: 0; }
.page header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
/* 見出しのすぐ右にボタン（商品リストの「＋ 新規追加」） */
.title-row { display: flex; align-items: center; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.month { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.month button { padding: 4px 12px; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1ec; white-space: nowrap; font-size: 14px; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbf9; }
td.num, th.num { text-align: right; }
tfoot th { border-top: 2px solid var(--line); }
.sum-dest { margin: 20px 0 8px; }
.warn { color: #c62828; font-size: 12px; font-weight: 600; }
/* 出荷データの表：広い画面でも列を寄せ、縦の罫線で区切る */
.table-wrap.fit { display: inline-block; max-width: 100%; vertical-align: top; }
table.grid { width: auto; }
table.grid th + th, table.grid td + td { border-left: 1px solid #e3e8e0; }
table.grid td.actions { box-shadow: none; }
#pickBody .table-wrap { margin-bottom: 8px; }
dialog#pickDialog { width: min(1000px, calc(100vw - 32px)); }
tr:last-child td { border-bottom: none; }
/* 操作のボタンは表を横に動かしても右端に見えるように */
td.actions { text-align: right; position: sticky; right: 0; background: var(--card); box-shadow: -6px 0 6px -6px rgba(0,0,0,.15); }
.thumb { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; vertical-align: middle; margin-right: 8px; background: var(--green-soft); }
.tag-ok { color: var(--ok); }
.tag-off { color: var(--error); }
.empty { padding: 32px; text-align: center; color: var(--muted); margin: 0; }

dialog { border: none; border-radius: 14px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #2b3229; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 10; max-width: 90vw;
}

@media (max-width: 640px) {
  .brand { display: none; }
  .page { padding: 16px; }
}

/* 出荷リスト（農場のタブ） */
/* 出荷先の左に商品の場所（1.61.0〜） */
.fs-place { font-size: 16px; margin-right: 8px; }
/* 出荷先を色の札で大きく（2026-11-08〜 スマホと同じ色） */
.dest-label { display: inline-block; color: #fff; font-weight: 700; font-size: 16px; padding: 2px 10px; border-radius: 8px; white-space: nowrap; }
/* 出荷待ちの件数（メニューとタブ・2026-11-08〜） */
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #c62828; color: #fff; font-size: 12px; font-weight: 600; text-align: center; line-height: 20px; }
.big-tabs .tab .count { background: #c62828; }
.big-tabs .tab { padding: 8px 18px; font-size: 15px; }
/* 出荷予定日の見出しは横いっぱいの帯（2026-11-12〜 スマホと同じ） */
.fs-day { margin: 16px 0 6px; padding: 8px 14px; background: var(--green); color: #fff; border-radius: 8px; font-size: 16px; }
.fs-day .muted { color: #fff; opacity: .9; }
.fs-day.none { background: #e3e8e0; color: var(--text); }
.fs-day.none .muted { color: var(--muted); }
#farmShipView tr.click td { cursor: pointer; }
.fs-body { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; font-size: 14px; }
.fs-body .k { color: var(--muted); }
.fs-body .v { white-space: pre-wrap; word-break: break-word; }
.fs-body hr { grid-column: 1 / -1; border: none; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }

/* 出荷枠が無くなった商品（スマホと同じく赤で、いちばん下） */
tr.soldout td { color: var(--error); }
tr.soldout td .muted { color: var(--error); opacity: .8; }

/* リクエスト（出荷できるのページ・スマホと同じ色：未確認は赤、ほかは濃い緑） */
.req-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.req-buttons:empty { display: none; }
button.req-unconfirmed { background: #c62828; color: #fff; border-color: #c62828; }
.req-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 12px; background: #1f5a2b; color: #fff; border: none; cursor: pointer; }
.req-badge.unconfirmed { background: #c62828; }
.req-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.req-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 12px; align-items: center; }
.req-card.unconfirmed { background: #fff3f3; border-color: #f2c2c2; }
.req-card .grow { flex: 1; min-width: 0; }
.req-card .title { font-weight: 600; }
.req-teian { display: inline-block; font-size: 11px; padding: 0 8px; border-radius: 10px; background: #1f5a2b; color: #fff; margin-left: 6px; }

/* 出荷先のページ：左に出荷先、右に配送業者（狭い画面では縦に） */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.col-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; min-height: 36px; }
.col-head h3 { margin: 0; }
#carrierRows td.wrap { max-width: 320px; }

/* 出荷先の並べ替え（ドラッグ） */
#destRows tr[draggable] { cursor: grab; }
/* 広い画面でも表を名前に寄せ（.fit・.grid）、行に乗せると色を付けてどの行のボタンかわかるように */
#destRows tr:hover td { background: #f3f7f1; }
#destRows tr.dragging { opacity: .5; background: var(--green-soft); }
td.handle { color: var(--muted); font-size: 18px; width: 32px; cursor: grab; user-select: none; }

/* 出荷商品・種・資材・ルール */
td.wrap { white-space: normal; min-width: 160px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #ffe0c2; color: #8a3d00; vertical-align: middle; }
tr.finished td { color: var(--muted); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f3f7f1; }
td.icon-cell { width: 48px; }
.icon-thumb { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.title { font-weight: 600; }
.small { font-size: 12px; margin-top: 2px; }
.crumbs { margin: 0 0 12px; font-size: 15px; }
.crumbs .link { font-size: 15px; }
#notesDesc { margin: 0 0 12px; white-space: pre-wrap; }

/* 記事を見る */
dialog.wide { width: min(640px, calc(100vw - 32px)); }
.prose { white-space: pre-wrap; word-break: break-word; line-height: 1.7; font-size: 15px; }
.photo { max-width: 100%; max-height: 360px; border-radius: 8px; object-fit: contain; align-self: flex-start; }
.wanted { margin: 0; padding: 8px 12px; border-radius: 8px; background: #ffe0c2; color: #8a3d00; font-weight: 600; }

/* 掲示板 */
textarea {
  font: inherit; font-size: 15px; color: var(--text); width: 100%; resize: vertical;
  padding: 10px 12px; border: 1px solid #b9c2b4; border-radius: 6px; background: #fff;
}
textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.compose { padding: 16px; margin-bottom: 16px; max-width: 760px; }
.compose .actions { margin-top: 8px; }
#postList { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.post { padding: 14px 16px; }
.post header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.post .post-actions { margin-left: auto; white-space: nowrap; }

/* 掲示板（1.21.0〜 フォルダのタブ・写真・既読・コメント） */
.row2 { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row2 .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; max-width: 760px; }
.tab { border-radius: 16px; padding: 6px 12px; }
.tab.active { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); font-weight: 600; }
.tab .count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 10px; background: #8a9486; color: #fff; font-size: 11px; }
.badge.folder { background: #ffe9cc; color: #8a4b00; }
.badge.done { background: #00897b; color: #fff; }
.done-row { margin: 8px 0; font-size: 13px; color: #00695c; }
.post-title { margin: 0 0 8px; font-size: 16px; }
.post-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.post-images img { width: 104px; height: 104px; object-fit: cover; border-radius: 10px; background: var(--green-soft); }
.readers { margin-top: 10px; font-size: 13px; color: var(--ok); background: #f3f6f2; padding: 6px 10px; border-radius: 8px; }
.post .link { margin-top: 6px; padding-left: 0; }
.comments { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.comment { background: #f6f7f5; border-radius: 10px; padding: 8px 10px; }
.comment .icon { padding: 0 4px; font-size: 12px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; }

/* 商品リスト・作業ログ・アカウントのアイコン（1.21.0〜） */
.status { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.status.s-before { background: #e3efe0; color: var(--green-dark); }
.status.s-between { background: #fff1d6; color: #8a5a00; }
.status.s-off { background: #eceeea; color: var(--muted); }
.act { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.act-create { background: #e3efe0; color: var(--green-dark); }
.act-update { background: #e3ecf8; color: #2a4d80; }
.act-delete { background: #fbe4e2; color: var(--error); }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--green-soft); color: var(--green-dark); font-weight: 600; vertical-align: middle; }

/* 写真の置き場（1.62.0〜） */
.photo-usage { margin-top: 24px; padding: 16px; border: 1px solid #ddd; border-radius: 8px; }
.photo-usage h3 { margin: 0 0 8px; }
.error-text { color: #c62828; }

/* アカウントの「申請」のオンオフ（1.71.0〜） */
label.switch { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }

/* 集計の選んで削除（2026-11-13〜） */
.sum-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
th.check, td.check { width: 32px; text-align: center; }
button.danger { color: #b3261e; border-color: #b3261e; }
button.danger:disabled { color: #aaa; border-color: #ddd; }

/* 写真応募（2026-11-17〜） */
.pet-list { display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.pet-card { display: flex; gap: 16px; padding: 16px; flex-wrap: wrap; }
.pet-photos { display: flex; gap: 8px; flex-wrap: wrap; align-content: flex-start; }
.pet-thumb { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: 132px; height: 132px; background: var(--green-soft); }
.pet-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pet-noimg { display: grid; place-items: center; height: 100%; padding: 6px; font-size: 12px; color: var(--muted); }
.pet-body { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.pet-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pet-name { font-size: 16px; }
.pet-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.pet-info dt { color: var(--muted); }
.pet-info dd { margin: 0; word-break: break-all; }
.pet-message { white-space: pre-wrap; }
.pet-actions { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.pet-actions .grow { flex: 1; min-width: 200px; }
.badge.pet-status-new { background: #c62828; color: #fff; }
.badge.pet-status-candidate { background: #ffe9cc; color: #8a4b00; }
.badge.pet-status-adopted { background: var(--green); color: #fff; }
.badge.pet-status-declined { background: #e0e0e0; color: #555; }
button.danger-text { color: var(--error); }
dialog.pet-photo-dialog { width: min(1100px, calc(100vw - 32px)); }
.pet-big-wrap { display: grid; place-items: center; min-height: 200px; background: #111; border-radius: 10px; overflow: hidden; }
.pet-big-wrap img { max-width: 100%; max-height: calc(100vh - 180px); display: block; }
.pet-big-wrap .empty { color: #ddd; }
.pet-photo-dialog .actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.pet-photo-dialog .actions .muted { margin-right: auto; }
a.button { display: inline-block; padding: 8px 14px; border-radius: 20px; border: 1px solid #b9c2b4; text-decoration: none; font-size: 14px; color: var(--text); background: #fff; }
a.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
a.button:not([href]) { opacity: .5; pointer-events: none; }
