/* 農地管理（ブラウザ版）。携帯用サーバーの農地マップ（Hukuchi.Mobile/wwwroot/assets/app.css）を土台にしている。屋外でも読めるよう文字は大きめ・コントラスト高め */
:root {
  --dark: #26392b; --primary: #3d6b43; --gold: #c9a646; --ink: #2b2a22; --text2: #4a4a3e; --sub: #6d6b5c;
  --line: #e3ded0; --surface: #fffdf7; --soft: #f4f1e6; --here: #2563eb; --hot: #d62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink); background: var(--soft); font-size: 16px; line-height: 1.55;
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; }

/* ---- 上の帯 ---- */
.bar {
  flex: none; display: flex; align-items: center; gap: 8px; background: var(--dark); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px;
}
.bar .logo { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.bar .ttl { flex: 1; min-width: 0; line-height: 1.25; }
.bar .ttl b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .ttl small { display: block; font-size: 11px; color: #a9b7a3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbtn {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 54px; padding: 5px 8px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 11px; font-weight: 700;
}
.hbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hbtn i {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--gold); color: var(--dark); font: 700 12px/20px sans-serif; font-style: normal; text-align: center;
}

/* ---- 番号で探す ---- */
.search { flex: none; display: flex; gap: 8px; padding: 8px 10px; background: var(--soft); border-bottom: 1px solid var(--line); }
.search[hidden] { display: none; }
.search input { flex: 1; min-width: 0; font-size: 18px; padding: 9px 12px; border: 1px solid #cfc9b6; border-radius: 10px; background: #fff; color: var(--ink); }
.search button { border: 0; border-radius: 10px; padding: 0 16px; font-size: 16px; font-weight: 700; background: var(--primary); color: #fff; }
.search button.ghost, .ghost { background: transparent; color: var(--text2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 700; }

/* ---- 地図 ---- */
.mapwrap { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #dfe6d8; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 253, 247, .85) !important; }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; font-size: 22px; }
.lbl {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  background: rgba(255, 255, 255, .92); border: 1px solid #333; border-radius: 3px; padding: 0 4px;
  font: 700 12px/1.35 sans-serif; color: #000;
}
.lbl.hot { background: #fff1f1; border-color: var(--hot); color: #a00; font-size: 14px; }
.lbl.tgt:not(.hot) { background: #ffb000; border-color: #7a5200; color: #2b1d00; font-size: 13px; }
.lbl.dim { opacity: .55; font-weight: 400; }
.zoom-low .lbl:not(.hot):not(.tgt), .zoom-mid .lbl.dim { display: none; }
.basebox { display: flex; background: #fff; border-radius: 10px; padding: 3px; box-shadow: 0 1px 6px rgba(0, 0, 0, .3); }
.basebox button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text2); }
.basebox button.on { background: var(--dark); color: #fff; }
.locate {
  position: absolute; right: 12px; bottom: 30px; z-index: 800; width: 70px; height: 70px; border-radius: 50%; border: 0;
  background: #fff; color: var(--dark); box-shadow: 0 3px 12px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; font-weight: 700;
}
.locate svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.locate.on { background: var(--here); color: #fff; }

/* ---- 下の情報 ---- */
.sheet {
  flex: none; max-height: 48vh; max-height: 48dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 14px);
}
.gps { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--sub); line-height: 1.5; }
.gps i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #c9c4b4; margin-top: 5px; }
.gps.ok i { background: #16a34a; }
.gps.wait i { background: var(--gold); animation: blink 1s infinite; }
.gps.warn i { background: #ea8a0c; }
.gps.err { color: #9b1c1c; }
.gps.err i { background: var(--hot); }
@keyframes blink { 50% { opacity: .3; } }

.card { margin-top: 8px; position: relative; }
.card:empty { display: none; }
.kicker { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--text2); }
.kicker.here { background: #dbeafe; color: #1e40af; }
.kicker.pick { background: #fff4dc; color: #8a5a00; }
.kicker.tgt { background: #ffb000; color: #2b1d00; }
.kicker.arrive { background: #16a34a; color: #fff; }
.way { margin: 6px 0 0; font-size: 15px; color: var(--here); }
.way b { font-size: 17px; }

/* ---- 対象の農地の一覧 ---- */
.thead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 12px; padding-bottom: 4px; border-bottom: 2px solid #ffb000; }
.card > .thead:first-child { margin-top: 2px; }
.thead b { font-size: 17px; color: var(--dark); }
.thead span { font-size: 13px; color: var(--sub); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlist { list-style: none; margin: 0; padding: 0; }
.tlist li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tlist li.at { background: #ecfdf3; }
.tno { flex: none; min-width: 64px; font-size: 22px; font-weight: 800; color: var(--dark); font-variant-numeric: tabular-nums; }
.tno small { font-size: 12px; font-weight: 700; margin-right: 1px; }
.tbody { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.tbody b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbody small { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbody em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--here); }
.tlist li.at .tbody em { color: #15803d; }
.tnav { flex: none; padding: 8px 12px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; }
.close { position: absolute; top: -4px; right: -6px; border: 0; background: transparent; color: var(--sub); font-size: 22px; line-height: 1; padding: 6px 10px; }
.head { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.head .no { font-size: 32px; font-weight: 800; color: var(--dark); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.head .no small { font-size: 16px; font-weight: 700; margin-right: 2px; }
.head .place { font-size: 20px; font-weight: 700; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; font-size: 14px; color: var(--text2); }
.facts b { color: var(--ink); font-size: 16px; }
.crops { margin-top: 10px; display: grid; gap: 6px; }
.crop { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 17px; font-weight: 700; }
.crop i { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.crop b { margin-left: auto; font-size: 17px; font-variant-numeric: tabular-nums; }
.crop small { font-size: 12px; color: var(--sub); font-weight: 700; }
.none { color: var(--sub); font-size: 14px; }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 6px; background: #fff4dc; color: #8a5a00; border: 1px solid #ecd9a6; }
.remarks { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: var(--soft); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.actions a, .actions button {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 700; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--dark);
}
.actions .primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.legend { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 3px; }
.hint { margin: 6px 0 0; font-size: 14px; color: var(--text2); }

/* ---- お知らせ ---- */
.panel {
  position: fixed; inset: 0; z-index: 2000; background: var(--surface); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.panel[hidden] { display: none; }
.panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--dark); color: #fff; font-size: 18px; }
.panel-head .ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.panel-foot { flex: none; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); background: var(--soft); line-height: 1.6; }
.nt { padding: 14px 0; border-bottom: 1px solid var(--line); }
.nt time { font-size: 13px; color: var(--sub); font-weight: 700; }
.nt h3 { margin: 2px 0 6px; font-size: 18px; color: var(--dark); }
.nt p { margin: 0; font-size: 16px; white-space: pre-wrap; word-break: break-word; }

/* ---- 読み込み中・エラー ---- */
.message {
  position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: rgba(255, 253, 247, .97); text-align: center; font-size: 17px; color: var(--ink);
}
.message[hidden] { display: none; }
.message button { border: 0; border-radius: 10px; padding: 10px 22px; font-size: 16px; font-weight: 700; background: var(--primary); color: #fff; }
.toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 2500; max-width: 90vw;
  background: rgba(38, 57, 43, .95); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
}

/* ================================================================ ブラウザ版で足したもの */
body { display: block; }
[hidden] { display: none !important; }
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.main { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.mapwrap { flex: 1; }
.hbtn { min-width: 50px; padding: 5px 6px; }
.sheet { max-height: 44vh; max-height: 44dvh; padding-bottom: 12px; }
.locate { bottom: 18px; }

/* ---- 下のタブ ---- */
.tabs {
  flex: none; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px;
  border: 0; background: transparent; color: var(--sub); font-size: 12px; font-weight: 700;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }

/* ---- ログイン ---- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--soft); }
.login-box { width: 100%; max-width: 380px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px; box-shadow: 0 4px 18px rgba(0, 0, 0, .08); }
.login-box img { justify-self: center; border-radius: 16px; }
.login-box h1 { margin: 0; text-align: center; font-size: 22px; color: var(--dark); line-height: 1.35; }
.login-box h1 small { display: block; font-size: 13px; color: var(--sub); font-weight: 700; }
.login-box label, .modal-box label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; color: var(--text2); }
.login-box input, .modal-box input, .modal-box textarea {
  font: inherit; font-size: 18px; padding: 10px 12px; border: 1px solid #cfc9b6; border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
.modal-box textarea { font-size: 16px; resize: vertical; }
.login-box button[type=submit] { border: 0; border-radius: 12px; padding: 13px; font-size: 18px; font-weight: 700; background: var(--primary); color: #fff; }
.login-box button[disabled] { opacity: .6; }
.login-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fdecec; color: #9b1c1c; font-size: 14px; }
.login-note { margin: 0; font-size: 13px; color: var(--sub); text-align: center; }

/* ---- 作業 ---- */
.plansel { display: grid; gap: 4px; margin-top: 2px; }
.plansel select { font: inherit; font-size: 16px; font-weight: 700; padding: 9px 10px; border: 1px solid #cfc9b6; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.progress { margin-top: 8px; }
.progress .nums { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--text2); }
.progress .nums b { font-size: 18px; color: var(--dark); }
.progress .barx { height: 10px; border-radius: 6px; background: #e8e3d3; overflow: hidden; margin-top: 4px; }
.progress .barx i { display: block; height: 100%; border-radius: 6px; }
.planmeta { margin: 6px 0 0; font-size: 13px; color: var(--sub); }
.planmemo { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--gold); background: var(--soft); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.state { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.state.todo { background: #fff4dc; color: #8a5a00; border: 1px solid #ecd9a6; }
.state.done { background: #dcfce7; color: #166534; border: 1px solid #a7e3bb; }
.donebtn { flex: none; border: 0; border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 700; background: #16a34a; color: #fff; }
.bigdone { display: block; width: 100%; margin-top: 10px; border: 0; border-radius: 12px; padding: 14px; font-size: 18px; font-weight: 800; background: #16a34a; color: #fff; }
.tlist li.isdone .tno { color: #15803d; }
.card-in { position: relative; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
details.donelist { margin-top: 10px; }
details.donelist summary { cursor: pointer; font-size: 15px; font-weight: 700; color: var(--dark); padding: 6px 0; }
.lbl.done:not(.hot) { background: #dcfce7; border-color: #166534; color: #14532d; }

/* ---- 台帳 ---- */
.ledger { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.lsearch { flex: none; padding: 10px 12px 6px; }
.lsearch input { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border: 1px solid #cfc9b6; border-radius: 10px; background: #fff; color: var(--ink); }
.chips { flex: none; display: flex; gap: 6px; padding: 0 12px 6px; overflow-x: auto; }
.chips button { flex: none; border: 1px solid var(--line); background: #fff; color: var(--text2); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.chips button.on { background: var(--dark); border-color: var(--dark); color: #fff; }
.lcount { flex: none; margin: 0; padding: 0 14px 6px; font-size: 13px; color: var(--sub); }
.llist { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; list-style: none; margin: 0; padding: 0 0 12px; border-top: 1px solid var(--line); }
.llist li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.llist li:active { background: var(--soft); }
.llist li.returned { opacity: .55; }
.llist .tbody small i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.llist .side { flex: none; text-align: right; font-size: 13px; color: var(--sub); line-height: 1.4; }
.llist .side b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- 農地の詳しい情報・自分 ---- */
.panel-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec { margin-top: 16px; }
.sec h3 { margin: 0 0 6px; font-size: 15px; color: var(--dark); border-bottom: 2px solid var(--line); padding-bottom: 3px; }
.kv { display: grid; grid-template-columns: 7.5em 1fr; gap: 4px 10px; font-size: 15px; margin: 0; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; word-break: break-word; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.rows li .grow { flex: 1; min-width: 0; }
.rows li small { color: var(--sub); }
.rows li i.sw { flex: none; width: 12px; height: 12px; border-radius: 3px; }
.ccard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.ccard.old { opacity: .7; }
.ccard .who { font-size: 18px; font-weight: 800; color: var(--dark); }
.ccard .who small { font-size: 12px; font-weight: 700; color: var(--sub); margin-left: 6px; }
.ccard a { color: var(--primary); font-weight: 700; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--primary); color: #fff; vertical-align: 2px; }
.me { font-size: 16px; line-height: 1.7; padding: 8px 0; }
.me b { font-size: 20px; color: var(--dark); }
.me small { display: block; font-size: 13px; line-height: 1.5; color: var(--sub); }
.actions.col { flex-direction: column; }
.actions.col button { justify-content: center; padding: 12px; font-size: 16px; }
.actions .danger { color: #9b1c1c; border-color: #f0c4c4; }
.about { font-size: 12px; color: var(--sub); line-height: 1.7; margin-top: 16px; }

/* ---- 終わったの記録 ---- */
.modal { position: fixed; inset: 0; z-index: 2600; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.modal-box {
  width: 100%; max-width: 480px; display: grid; gap: 12px; background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 16px); max-height: 92dvh; overflow-y: auto;
}
.modal-box h2 { margin: 0; font-size: 19px; color: var(--dark); }
.done-summary { margin: 0; font-size: 16px; font-weight: 700; padding: 10px 12px; border-radius: 10px; background: #ecfdf3; color: #14532d; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; padding: 13px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.modal-actions .primary { border: 0; background: #16a34a; color: #fff; }
.modal-actions .primary[disabled] { opacity: .6; }
@media (min-width: 700px) {
  .modal { align-items: center; }
  .modal-box { border-radius: 16px; }
}

/* ---- パソコンの広い画面：下の情報を右に置く ---- */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: auto auto 1fr auto; }
  .bar, .search, .tabs { grid-column: 1 / -1; }
  .bar { grid-row: 1; }
  .search { grid-row: 2; }
  .tabs { grid-row: 4; }
  .main { grid-column: 1; grid-row: 3; }
  .sheet { grid-column: 2; grid-row: 3; max-height: none; border-top: 0; border-left: 1px solid var(--line); box-shadow: none; }
  .app.wide-main .main { grid-column: 1 / -1; }
  .tabs { justify-content: center; }
  .tabs button { flex: 0 0 140px; }
}

