:root {
    --primary: #0f766e;        /* teal-700：官公庁書類らしい落ち着いた緑青 */
    --primary-deep: #0b524c;
    --primary-soft: #e6f4f2;
    --ink: #1f2937;
    --ink-2: #556170;
    --ink-3: #8a95a3;
    --line: #e3e7ec;
    --paper: #ffffff;
    --bg: #eef1f4;
    --red: #e00000;           /* 強調（赤枠・赤斜線・矢印） */
    --font: "Hiragino Kaku Gothic ProN","Hiragino Sans","Noto Sans JP","Yu Gothic",Meiryo,system-ui,sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    font-family: var(--font);
    color: var(--ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }

/* ===== レイアウト（中央寄せ1カラム） ===== */
.app-shell {
    width: 100%;
    max-width: 720px;
    margin-inline: auto;
    min-height: 100dvh;
    background: var(--paper);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,.05);
}
/* PC・大きな画面。地図は正方形なので横幅は控えめにする */
@media (min-width: 900px) {
    .app-shell { max-width: 860px; }
    .app-main { padding: 20px 24px 30px; }
    /* 住所などの入力欄は広げすぎると間延びするので上限を設ける */
    .field .form-control { max-width: 560px; }
}

.app-header {
    position: sticky; top: 0; z-index: 500;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
}
.app-header h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: .01em; }
.header-link { color: #fff; font-size: 18px; opacity: .9; padding: 6px; }
.header-link:hover { opacity: 1; }

.app-main { flex: 1; padding: 16px 16px 28px; }
img, table, pre { max-width: 100%; }

/* ===== リード ===== */
.lead-box { padding: 4px 4px 16px; }
.lead-title { font-size: 20px; font-weight: 800; margin: 4px 0 8px; }
.lead-title strong { color: var(--primary); }
.lead-desc { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.hl-red { color: var(--red); font-weight: 700; }
.lead-note {
    font-size: 12.5px; color: var(--ink-2);
    background: var(--primary-soft); border-radius: 10px;
    padding: 8px 12px; margin: 0;
}
.lead-note i { color: var(--primary); margin-right: 4px; }

/* ===== カード ===== */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 16px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 16px; font-weight: 800; margin: 0 0 14px;
    display: flex; align-items: center; gap: 8px;
}
.step-badge {
    font-size: 11px; font-weight: 800; letter-spacing: .04em;
    color: #fff; background: var(--primary);
    padding: 3px 9px; border-radius: 999px;
}

/* ===== 入力フィールド ===== */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.input-row { display: flex; gap: 8px; }
.form-control, .form-select {
    font-size: 15px; border-radius: 10px; border: 1px solid var(--line);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 .18rem rgba(15,118,110,.18);
}
/* プレースホルダーは薄い灰色（入力済みと見分けやすく） */
.form-control::placeholder { color: #9aa1a8; opacity: 1; }
.form-control::-webkit-input-placeholder { color: #9aa1a8; }
.form-control::-moz-placeholder { color: #9aa1a8; opacity: 1; }
.field-check { margin: -4px 0 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ===== ボタン ===== */
.btn-main {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 50px;
    font-size: 16px; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    border: none; border-radius: 12px; cursor: pointer;
    text-decoration: none;
}
.btn-main:hover { filter: brightness(1.05); color: #fff; }
.btn-main:active { transform: translateY(1px); }
.btn-main:disabled { opacity: .55; cursor: default; }
.btn-sub {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 46px;
    font-size: 14.5px; font-weight: 700; color: var(--primary);
    background: var(--primary-soft); border: none; border-radius: 12px; cursor: pointer;
}

/* ===== ジオコーディングメッセージ ===== */
.geo-msg { margin: 12px 0 0; font-size: 13px; padding: 9px 12px; border-radius: 10px; }
.geo-msg.ok { background: #eefaf3; color: #12683f; }
.geo-msg.ng { background: #fdecec; color: #b42318; }
.geo-msg.load { background: var(--primary-soft); color: var(--primary-deep); }

/* ===== 地図 ===== */
.map-help { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.map-help i { color: var(--primary); margin-right: 4px; }
.map-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.map-canvas {
    width: 100%; aspect-ratio: 1 / 1;   /* 正方形（様式に余白なく貼れる） */
    max-width: 620px; margin-inline: auto;
    border-radius: 12px; border: 1px solid var(--line); overflow: hidden;
    background: #dfe3e8;
}
.tb-btn { width: auto; min-height: 36px; font-size: 12.5px; padding-inline: 12px; }

/* ===== STEPが現れるときのアニメーション ===== */
@keyframes stepIn {
    from { opacity: 0; transform: translateY(16px) scale(.985); }
    to   { opacity: 1; transform: none; }
}
.step-in { animation: stepIn .45s cubic-bezier(.22,.8,.28,1) both; }
@media (prefers-reduced-motion: reduce) {
    .step-in { animation: none; }
    html { scroll-behavior: auto; }
}

/* ===== ウィザード ===== */
.wiz-guide {
    background: #fff6f6; border: 1px solid #f3c2c2; border-left: 5px solid var(--red);
    border-radius: 10px; padding: 11px 14px; margin-bottom: 10px;
}
.wiz-guide-head { display: flex; align-items: center; gap: 9px; }
.wiz-badge {
    display: grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0;
    background: var(--red); color: #fff; font-weight: 800; font-size: 14px; border-radius: 50%;
}
.wiz-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.wiz-text { font-size: 13.5px; color: var(--ink-2); margin: 7px 0 0; }
.wiz-text strong { color: var(--red); }

.wiz-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; margin-bottom: 16px; }
.wiz-btn { width: auto; min-height: 46px; white-space: nowrap; }
#btnWizBack, #btnWizUndo, #btnWizRedraw { flex: 0 1 auto; padding-inline: 14px; }
#btnWizNext { flex: 1 1 120px; padding-inline: 16px; }

/* ===== 配置図：入力方法の切替 ===== */
.mode-pick {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
    background: #f6f8f9; border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 12px; margin-bottom: 12px;
}
.mode-pick .check { font-size: 13.5px; }
.mode-pick input { width: 17px; height: 17px; accent-color: var(--primary); }
.stp-rot { font-size: 12px !important; font-weight: 800; }

/* ===== 配置図：寸法入力 ===== */
.dim-box {
    margin-top: 14px; padding: 13px 14px;
    background: var(--primary-soft); border: 1px solid #bfe0dc; border-radius: 12px;
}
.dim-lead { font-size: 12.5px; color: var(--primary-deep); font-weight: 700; margin: 0 0 10px; }
.dim-lead i { margin-right: 5px; }
.dim-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.dim-label { font-size: 14px; font-weight: 800; width: 3.2em; flex-shrink: 0; }
.dim-unit { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .stp {
    width: 42px; height: 42px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 14px; color: #fff; background: var(--primary);
    border: none; border-radius: 10px; cursor: pointer;
}
.stepper .stp:active { transform: translateY(1px); }
.dim-input {
    width: 92px; height: 42px; text-align: center;
    font-size: 17px; font-weight: 800; color: var(--ink);
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.dim-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 .18rem rgba(15,118,110,.18); }
/* スピナー（ブラウザ標準）は自前ボタンがあるので隠す */
.dim-input::-webkit-outer-spin-button, .dim-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dim-input { -moz-appearance: textfield; appearance: textfield; }
.dim-auto { width: auto; min-height: 38px; font-size: 13px; padding-inline: 14px; margin-top: 2px; }
.dim-checks {
    display: flex; flex-wrap: wrap; gap: 10px 22px;
    margin: 12px 0 10px; padding-top: 12px;
    border-top: 1px dashed #bfe0dc;
}
.dim-checks .check { font-size: 13.5px; align-items: flex-start; }
.dim-checks strong { color: var(--red); }
.dim-hint {
    font-size: 12px; color: #8a6d1a; background: #fdf3d6;
    border-radius: 8px; padding: 7px 10px; margin: 2px 0 0;
}
.dim-hint i { margin-right: 4px; }

/* ズームは＋−ボタンのみ（ホイール無効）なので、押しやすく大きめに */
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
    width: 40px; height: 40px; line-height: 40px;
    font-size: 22px; font-weight: 700; color: var(--primary-deep);
}

/* 「ここをタップで閉じる」ツールチップ */
.leaflet-tooltip.shako-close-tip {
    background: #0b8a00; color: #fff; border: none; font-weight: 700; font-size: 12px;
    padding: 3px 9px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.leaflet-tooltip.shako-close-tip::before { border-top-color: #0b8a00; }

.dist-line {
    font-size: 13.5px; color: var(--ink); margin: 6px 0 14px;
    background: #fff6f6; border: 1px dashed #f0b4b4; border-radius: 10px; padding: 8px 12px;
}
.dist-line i { color: var(--red); margin-right: 4px; }
.dist-line strong { color: var(--red); }

/* ===== 結果画像 ===== */
.result-img-wrap {
    border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
    background: #f4f6f8; margin-bottom: 14px;
}
#resultImg { display: block; width: 100%; height: auto; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-note { font-size: 12px; color: var(--ink-3); margin: 12px 0 0; }

/* ===== 他書類（工事中） ===== */
.other-docs { background: #fafbfc; }
.other-lead { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.doc-list li:last-child { border-bottom: none; }
.doc-name { color: var(--ink-2); }
.doc-badge {
    font-size: 11px; font-weight: 700; color: #8a6d1a;
    background: #fdf3d6; border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}

/* ==================================================================
 * 様式「保管場所の所在図・配置図」（A4横）
 * 寸法はmm指定。画面ではそのまま原寸表示し、狭い画面では横スクロールさせる。
 * ================================================================== */
.form-lead { font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; }
.a4-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }

.form-a4 {
    width: 285mm; min-width: 285mm;
    background: #fff; color: #000;
    font-family: "Hiragino Mincho ProN","Yu Mincho","MS PMincho","Noto Serif JP",serif;
    padding: 2mm 0 0;
}
.ff-title { text-align: center; font-size: 4.4mm; letter-spacing: .4mm; margin-bottom: 1mm; }

.form-a4 table { border-collapse: collapse; table-layout: fixed; }
.ff-main { width: 100%; }
.ff-main th, .ff-main td { border: 0.35mm solid #000; }
/* Bootstrapのrebootが th{text-align:inherit} を当てるため、中央寄せを明示する。
   letter-spacing は最後の1文字の後ろにも入るので、その分だけ左に足して見た目の中心を合わせる */
.ff-head {
    width: 50%; height: 8mm; font-size: 3.5mm; font-weight: normal;
    letter-spacing: .3mm; text-align: center; text-indent: .3mm;
}
/* 記載欄は正方形。正方形の地図画像を余白なく貼り付ける */
.ff-cell { padding: 0; vertical-align: middle; text-align: center; }
.ff-figure { width: 100%; aspect-ratio: 1 / 1; overflow: hidden; line-height: 0; }
.ff-img { display: none; width: 100%; height: 100%; object-fit: cover; }

.ff-shutter { margin-left: auto; }
.ff-shutter td { border: 0.35mm solid #000; border-top: none; height: 8mm; font-size: 3.2mm; text-align: center; }
.sh-label { width: 42mm; }
.sh-val { width: 42mm; letter-spacing: .2mm; }
/* 選択したほうを丸で囲む */
.sh-on {
    display: inline-block; width: 7mm; height: 7mm; line-height: 6.2mm;
    border: 0.4mm solid #000; border-radius: 50%; text-align: center;
}

.ff-notes { font-size: 2.4mm; line-height: 1.38; margin-top: 1.2mm; }
.nt { display: grid; grid-template-columns: 8mm 5mm 1fr; }
.nt-lb, .nt-no { white-space: nowrap; }
.nt-tx { text-align: justify; }

/* ---- 印刷 ---- */
@page { size: A4 landscape; margin: 6mm; }
@media print {
    html, body { background: #fff !important; }
    /* 罫線や塗りをブラウザに間引かせない */
    .form-a4, .form-a4 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .form-a4 img[src] { display: block; }   /* srcの無い空の枠は出さない */
    .no-print { display: none !important; }
    .app-shell { max-width: none; min-height: 0; box-shadow: none; background: #fff; }
    .app-main { padding: 0; }
    #cardForm { display: block !important; border: none; border-radius: 0; padding: 0; margin: 0; background: #fff; }
    .a4-wrap { overflow: visible; padding: 0; }
    .form-a4 { width: 100%; min-width: 0; padding: 0; }
    .step-in { animation: none; }
}

/* ===== フッター ===== */
.app-footer {
    padding: 20px 18px 28px; text-align: center;
    font-size: 12px; color: var(--ink-3);
    border-top: 1px solid var(--line);
}
.app-footer a { color: var(--primary); }

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
    .app-main { padding: 14px 12px 24px; }
    .card { padding: 16px 13px; }
    .lead-title { font-size: 18px; }
}

/* ドラッグ用の赤ピン（divIcon） */
.pin-label {
    background: var(--red); color: #fff; font-size: 12px; font-weight: 800;
    padding: 2px 8px; border-radius: 999px; white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    border: 1.5px solid #fff;
    transform: translate(-50%, -140%);
    display: inline-block;
}

/* Google書き出しの切替（ツールバー内） */
.tb-check { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tb-check input { width: 16px; height: 16px; accent-color: var(--primary); }
/* Google書き出しの切替は見つけやすく強調する */
.tb-gmap {
    border: 1px solid #cfd6dd; border-radius: 999px;
    padding: 5px 12px 5px 10px; background: #fff;
}
.tb-gmap:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }

/* ライブ地図の方位磁石 */
.shako-compass { line-height: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,.25)); }
.shako-compass svg { display: block; }

/* 地図の向き（回転）ボタン・方位磁石 */
.tb-rotate { gap: 6px; }
.rot-btn, .rot-north { min-width: 40px; padding-inline: 10px; }
.shako-compass { transform-origin: 50% 50%; transition: transform .15s; }

/* 「任意」注記 */
.opt-note {
    display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700;
    color: var(--primary-deep); background: var(--primary-soft);
    padding: 1px 7px; border-radius: 999px;
}

/* 集合駐車場のNo.欄 */
.no-field { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.no-prefix { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.no-input { width: 74px; text-align: center; }

/* Googleマップ種類の選択ポップアップ */
.shako-modal-ov {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.shako-modal {
    background: #fff; border-radius: 14px; padding: 20px 18px 16px;
    width: 100%; max-width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.sm-title { font-size: 15px; font-weight: 800; color: var(--ink); margin: 0 0 14px; text-align: center; }
.sm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sm-btns button {
    min-height: 52px; font-size: 14.5px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    border: none; border-radius: 10px; cursor: pointer;
}
.sm-btns button:active { transform: translateY(1px); }
.sm-cancel {
    width: 100%; min-height: 44px; margin-top: 12px;
    font-size: 14px; font-weight: 700; color: var(--ink-2);
    background: #f0f2f4; border: none; border-radius: 10px; cursor: pointer;
}

/* ヘッダーの複数リンク（作業ページ：使い方＋一覧） */
.header-links { display: flex; align-items: center; gap: 6px; }

/* 保存(PNG)など控えめにしたいボタンの白抜きスタイル（btn-main の後に置いて上書き） */
.btn-outline {
    background: #fff; color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-soft); color: var(--primary-deep); filter: none; }
