/* ============================================
   三葉産業 工事写真管理 共通スタイル
   基準デバイス: iPad 横向き（1194×834 / 1180×820）
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
    --ink: #1a1a1a;
    --line: #444;
    --accent: #1a5c96;
    --paper: #ffffff;
    --bg: #eef1f4;
    --red: #d92b1c;
    --yellow: #ffef6b;
    --khaki: #e6e6cf;
    --orange: #e8b83a;
    --blue-cell: #cfe2f3;
    --edit-bg: #fffbe0;
}

html { font-size: 16px; }

body {
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(26, 92, 150, .15);
}

/* ---------- ヘッダー ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header .brand {
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
}
.app-header .brand small { font-weight: 400; opacity: .85; margin-left: 8px; }

.container { max-width: 1220px; margin: 0 auto; padding: 12px 14px 40px; }

/* ---------- ボタン（タッチターゲット44px以上） ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn:active { opacity: .85; }

/* ---------- 通知 ---------- */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e6b1e;
    color: #fff;
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 700;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    transition: opacity .4s;
}
.toast.hide { opacity: 0; pointer-events: none; }

.error-box {
    background: #fdecea;
    border: 1px solid var(--red);
    color: #8a1a10;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: .9rem;
}

/* ---------- 検索バー ---------- */
.search-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.search-bar input[type="search"],
.search-bar select {
    min-height: 44px;
    font-size: 1rem;
    font-family: inherit;
    padding: 6px 12px;
    border: 1px solid #aab;
    border-radius: 8px;
    background: #fff;
}
.search-bar input[type="search"] { flex: 1 1 220px; }

/* ---------- ハンバーガーメニュー＆サイドバー ---------- */
.menu-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
}
.menu-btn span {
    display: block;
    height: 2.5px;
    border-radius: 2px;
    background: #fff;
}
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 32, .45);
    z-index: 800;
}
.app-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 290px;
    height: 100vh;
    background: #fff;
    z-index: 810;
    box-shadow: 2px 0 16px rgba(0,0,0,.18);
    transition: left .22s ease;
    display: flex;
    flex-direction: column;
}
.app-drawer.open { left: 0; }
.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eef1f4;
}
.drawer-title { font-weight: 700; color: var(--accent); }
.drawer-close {
    border: none;
    background: none;
    font-size: 1.1rem;
    color: #778;
    cursor: pointer;
    padding: 8px 10px;
}
.drawer-nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; }
.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #2b3440;
    font-weight: 600;
    font-size: .98rem;
}
.drawer-link svg { color: #7d8b98; flex: 0 0 20px; }
.drawer-link.active { background: #eaf2fa; color: var(--accent); }
.drawer-link.active svg { color: var(--accent); }
.drawer-link:active { background: #f2f6fa; }

/* ---------- テンプレート管理 ---------- */
.page-title { font-size: 1.15rem; font-weight: 700; }
.template-list { display: flex; flex-direction: column; gap: 10px; }
.template-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #dfe4e9;
    border-radius: 10px;
    padding: 16px 18px;
}
.tpl-info { flex: 1 1 auto; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tpl-info .tpl-name { font-size: 1.05rem; font-weight: 700; }
.tpl-info .tpl-desc { font-size: .87rem; color: #556; }
.tpl-info .tpl-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-chip {
    background: #eef2f6;
    color: #445;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 700;
    padding: 2px 10px;
}
.tpl-chip.slots { background: #e3edf7; color: var(--accent); }
.tpl-chip.used { background: #edf7e8; color: #2c6b1e; }
.tpl-actions { display: flex; gap: 8px; align-items: center; }
.tpl-actions form { display: inline; }

.section-block {
    border: 1px solid #dfe4e9;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: #fafbfc;
}
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 12px;
}
.info-note {
    background: #fff8e6;
    border: 1px solid #e6d290;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: .9rem;
}
@media (max-width: 800px) {
    .slot-grid { grid-template-columns: repeat(2, 1fr); }
    .template-row { flex-direction: column; align-items: stretch; }
}

/* ---------- 2ペイン（フォルダーツリー＋帳票一覧） ---------- */
.explorer {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.folder-panel {
    flex: 0 0 300px;
    background: #fff;
    border: 1px solid #dfe4e9;
    border-radius: 8px;
    padding: 4px 12px 16px;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.fp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 2px 8px;
    border-bottom: 1px solid #eef1f4;
    margin-bottom: 8px;
}
.fp-title { font-weight: 700; color: var(--accent); font-size: .95rem; }
.folder-content { flex: 1 1 auto; min-width: 0; }

/* --- フォルダーツリー --- */
.tree {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tree .tree {
    margin-left: 12px;
    padding-left: 14px;
    border-left: 1px dotted #c6ccd3;
}
.tree-row {
    display: flex;
    align-items: center;
    min-height: 42px;
    border-radius: 6px;
    position: relative;
}
.tree .tree > .tree-node > .tree-row::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    width: 12px;
    border-top: 1px dotted #c6ccd3;
}
.tree-row.current { background: #eaf2fa; }
.tree-row.current .tree-name { color: var(--accent); }
.tree-row:active { background: #f2f6fa; }
.tree-toggle {
    flex: 0 0 28px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #a3adb8;
    cursor: pointer;
    padding: 0;
}
.tree-toggle svg { transform: rotate(90deg); transition: transform .15s; }
.tree-node.closed > .tree-row .tree-toggle svg { transform: rotate(0deg); }
.tree-node.closed > .tree { display: none; }
.tree-toggle.spacer { pointer-events: none; }
.tree-link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 6px 8px 0;
    text-decoration: none;
    color: #2b3440;
    font-weight: 600;
    font-size: .92rem;
}
.tree-icon { flex: 0 0 18px; }
.tree-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-count {
    margin-left: auto;
    color: #97a1ab;
    font-size: .78rem;
    font-weight: 600;
    padding-right: 2px;
}
.folder-delete-current {
    margin-left: auto;
    border: 1px solid var(--red);
    color: var(--red);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}

@media (max-width: 960px) {
    .explorer { flex-direction: column; }
    .folder-panel { flex: none; width: 100%; position: static; max-height: none; }
}

/* ---------- フォルダー階層（エクスプローラー風） ---------- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #ccd;
    border-radius: 10px;
    padding: 8px 14px;
    margin-bottom: 14px;
}
.crumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--accent);
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
}
.crumb:active { background: #eef4fa; }
.crumb.current { color: var(--ink); pointer-events: none; }
.crumb-sep { color: #99a; font-weight: 700; }
.btn-sm { min-height: 38px; padding: 4px 14px; font-size: .9rem; }

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.folder-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fdf8ec;
    border: 1px solid #e3d5ae;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--ink);
    min-height: 68px;
}
.folder-card:active { background: #f7eed6; }
.folder-icon { font-size: 1.9rem; line-height: 1; }
.folder-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.folder-name {
    font-weight: 700;
    font-size: 1.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-meta { font-size: .78rem; color: #776a45; }
.folder-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    background: none;
    color: #b0a37c;
    font-size: .95rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
}
.folder-delete:active { background: #eee0ba; color: var(--red); }

.new-folder-form {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fdf8ec;
    border: 2px dashed #d8c88f;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.new-folder-form input[type="text"] {
    flex: 1;
    min-height: 44px;
    font-size: 1rem;
    font-family: inherit;
    padding: 6px 12px;
    border: 1px solid #ccb;
    border-radius: 8px;
}
.search-note { font-weight: 700; color: #556; margin-bottom: 10px; }
.folder-tag {
    display: inline-block;
    background: #fdf8ec;
    border: 1px solid #e3d5ae;
    border-radius: 6px;
    padding: 1px 8px;
    margin-right: 8px;
    font-size: .78rem;
    color: #776a45;
    font-weight: 700;
}

/* ---------- 案件一覧 ---------- */
.project-list { display: flex; flex-direction: column; gap: 10px; }

.project-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--paper);
    border: 1px solid #ccd;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--ink);
    min-height: 72px;
}
.project-card:active { background: #f0f6fc; }
.project-card .mgmt-no {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    min-width: 5.2em;
}
.project-card .pole { flex: 1 1 auto; min-width: 0; }
.project-card .pole .no { font-size: 1.15rem; font-weight: 700; }
.project-card .pole .detail { font-size: .85rem; color: #556; margin-top: 2px; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge.target { background: #e3edf7; color: var(--accent); }
.badge.excluded { background: var(--red); color: #fff; }
.badge.status { background: #eee; color: #333; border: 1px solid #ccc; }
.badge.status.st-調査中,
.badge.status.st-工事中 { background: #fff3cd; border-color: #e0c060; color: #7a5c00; }
.badge.status.st-調査完了,
.badge.status.st-工事完了 { background: #d9efd9; border-color: #7bbf7b; color: #1e6b1e; }

.photo-progress { font-size: .85rem; color: #556; white-space: nowrap; }
.photo-progress b { font-size: 1.1rem; color: var(--ink); }

.pagination-wrap { margin-top: 16px; display: flex; justify-content: center; }

.empty-note {
    background: #fff;
    border: 1px dashed #bbc;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    color: #667;
}

/* ---------- シート上部の操作バー ---------- */
.sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-select { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 700; }
.status-select select {
    min-height: 44px;
    font-size: 1rem;
    font-family: inherit;
    padding: 4px 10px;
    border: 1px solid #aab;
    border-radius: 8px;
    background: #fff;
}
.status-select select:disabled {
    color: var(--ink);
    opacity: 1;
    -webkit-text-fill-color: var(--ink);
    background: #f2f2f2;
}

/* ============================================
   案件シート（帳票フォーマット再現）
   iPad横（内寸約1160px）にちょうど収まる設計
   ============================================ */
.sheet-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sheet {
    background: var(--paper);
    border: 1px solid #999;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    padding: 16px 18px 22px;
    width: 100%;
    min-width: 1024px;
    font-size: .78rem;
    line-height: 1.3;
}

.sheet table { border-collapse: collapse; }
.sheet td, .sheet th {
    border: 1px solid var(--line);
    padding: 2px 4px;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
}

/* --- セル内入力欄：紙帳票の見た目を崩さない --- */
.sheet input[type="text"],
.sheet input[type="number"] {
    width: 100%;
    min-height: 30px;
    border: none;
    background: transparent;
    font: inherit;
    text-align: center;
    color: var(--ink);
    padding: 1px 2px;
}
.sheet input:disabled,
.sheet textarea:disabled {
    color: var(--ink);
    opacity: 1;
    -webkit-text-fill-color: var(--ink);
}
.sheet input[type="number"]::-webkit-outer-spin-button,
.sheet input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sheet input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* 編集モード中は入力欄を薄黄色でハイライト */
body.editing .sheet input:not(:disabled),
body.editing .sheet textarea:not(:disabled) {
    background: var(--edit-bg);
    box-shadow: inset 0 0 0 1px #d9c869;
    border-radius: 2px;
}

/* --- 上段：委託情報 / タイトル / 管理番号 --- */
.sheet-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.consign-table td { min-width: 3em; height: 28px; }
.consign-table td:first-child { min-width: 7.5em; }
.consign-table .lbl { font-weight: 700; }
.consign-table .num-cell { min-width: 4.5em; }
.cell-yellow { background: var(--yellow); }
.cell-khaki  { background: var(--khaki); }
.cell-orange { background: var(--orange); }
.cell-blue   { background: var(--blue-cell); }
.cell-red    { background: var(--red); color: #fff; font-weight: 700; }

.sheet-title { flex: 1 1 auto; text-align: center; margin-top: 4px; }
.sheet-title .pole-no {
    display: inline-block;
    border: 2px solid var(--ink);
    padding: 8px 22px;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.sheet-corner { text-align: center; min-width: 8.5em; }
.sheet-corner .office { font-size: 1.15rem; font-weight: 700; }
.sheet-corner .no { font-size: 1.05rem; margin-top: 2px; }
.sheet-corner .excluded {
    margin-top: 6px;
    display: inline-block;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    padding: 3px 10px;
    font-size: .85rem;
    white-space: nowrap;
}

/* --- 中段 --- */
.sheet-mid {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 8px;
}

.basic-block {
    width: 320px;
    flex: 0 0 320px;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}
.basic-block .row { display: flex; border-bottom: 1px solid var(--line); }
.basic-block .row-tall { flex: 1 1 auto; min-height: 52px; }
.basic-block .lbl {
    flex: 0 0 6em;
    font-weight: 700;
    padding: 6px;
    text-align: left;
    border-right: 1px solid var(--line);
    display: flex;
    align-items: center;
}
.basic-block .val { flex: 1; padding: 2px 4px; display: flex; align-items: center; }
.basic-block .val input { text-align: left; }
.company-line { text-align: center; font-weight: 700; padding: 7px; }

.shoot-marks { display: flex; align-items: center; gap: 14px; font-size: 1rem; font-weight: 700; }
.shoot-marks .mark {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: relative;
    cursor: pointer;
    padding: 4px 0;
}
.shoot-marks .mark input { position: absolute; opacity: 0; width: 100%; height: 100%; }
.shoot-marks .box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35em; height: 1.35em;
    border: 1.5px solid var(--ink);
    background: #fff;
    font-size: 1em;
}
.shoot-marks .mark input:checked + .box::after { content: "✓"; font-weight: 700; }
body.editing .shoot-marks .mark input:not(:disabled) + .box { background: var(--edit-bg); box-shadow: 0 0 0 1px #d9c869; }

.complete-table { width: 210px; flex: 0 0 210px; }
.complete-table .head { font-weight: 700; width: 55%; height: 44px; }
.complete-table .head .small { font-weight: 400; font-size: .65rem; }
.complete-table .input-cell { background: #fff; }

.site-area { flex: 1 1 auto; }
.site-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 3px; font-size: .82rem; }
.site-table { width: 100%; }
.site-table td { height: 30px; }
.site-table .lbl { font-weight: 700; text-decoration: underline; width: 9%; }
.site-table .lbl-plain { font-weight: 700; width: 9%; }
.site-table .lbl-app { width: 9%; font-size: .72rem; }
.site-table td:nth-child(even) { width: 10%; }

/* --- 注意書き --- */
.sheet-note {
    color: var(--red);
    font-weight: 700;
    font-size: .88rem;
    margin: 8px 0 4px;
}

/* --- 写真枠 --- */
.photo-section { margin-top: 6px; }
.photo-section .sec-title { font-weight: 700; font-size: .92rem; margin: 6px 0 2px; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
}
.photo-cell {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.photo-cell .slot-label {
    font-size: .68rem;
    text-align: center;
    padding: 1px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px dotted #bbb;
    min-height: 1.35em;
}
.photo-cell .slot-label .n { margin-right: .3em; color: #667; }

.photo-frame {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #fbfbfb;
    position: relative;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.photo-frame input[type="file"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a8adb5;
    font-size: .68rem;
    gap: 3px;
}
.photo-frame .placeholder .cam { font-size: 1.5rem; }
.photo-frame:active { background: #eef4fa; }

/* --- 備考欄 --- */
.remarks-box {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    min-height: 56px;
    margin-top: 12px;
    padding: 6px 8px;
    font: inherit;
    color: var(--ink);
    background: transparent;
    resize: vertical;
}

/* ---------- 電子黒板設定 ---------- */
.stamp-settings {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #f4f7fa;
    border: 1px solid #cdd8e3;
    border-radius: 8px;
    padding: 8px 14px;
    margin: 8px 0;
    font-size: .82rem;
}
.stamp-settings .ss-title {
    font-weight: 700;
    color: var(--accent);
    background: #fff;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 3px 10px;
}
.stamp-settings label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.stamp-settings select {
    min-height: 38px;
    font-size: .9rem;
    font-family: inherit;
    padding: 3px 8px;
    border: 1px solid #aab;
    border-radius: 6px;
    background: #fff;
}
.stamp-settings .ss-note { color: #667; font-size: .75rem; }
.stamp-settings .ss-saved { color: #1e6b1e; font-weight: 700; }

/* ---------- 加筆エディタ ---------- */
.editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 30, .96);
    z-index: 600;
    display: flex;
    flex-direction: column;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #23292f;
}
.tool-group { display: flex; align-items: center; gap: 8px; }
.tool-btn {
    min-height: 44px;
    padding: 6px 14px;
    border: 1px solid #566;
    border-radius: 8px;
    background: #2f363d;
    color: #dde;
    font-size: .95rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.tool-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.color-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
}
.color-btn.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.editor-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}
#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    background: #000;
    touch-action: none;
    cursor: crosshair;
}

/* ---------- アプリ内カメラ（電子黒板オーバーレイ） ---------- */
.camera-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 700;
    display: flex;
    flex-direction: column;
}
.camera-stage {
    position: relative;
    flex: 1;
    overflow: hidden;
}
#camera-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.bb-board {
    position: absolute;
    left: 16px;
    bottom: 16px;
    width: 250px;
    height: auto;
    touch-action: none;
    cursor: move;
    box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.camera-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 20px;
    background: #16191d;
}
.cam-group { display: flex; align-items: center; gap: 8px; }
.cam-label { color: #9aa3ad; font-size: .8rem; font-weight: 700; }
.shutter-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: #e8e8e8;
    box-shadow: inset 0 0 0 3px #16191d;
    cursor: pointer;
}
.shutter-btn:active { background: #bbb; }
.cam-hint {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,.45);
    font-size: .78rem;
    padding: 4px 14px;
    border-radius: 14px;
    pointer-events: none;
}

/* ---------- 新規登録フォーム ---------- */
.create-form { max-width: 900px; }
.form-section {
    background: #fff;
    border: 1px solid #ccd;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.form-section legend {
    font-weight: 700;
    padding: 0 8px;
    color: var(--accent);
}
.template-options { display: flex; flex-direction: column; gap: 10px; }
.template-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 2px solid #ccd;
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
}
.template-card:has(input:checked) { border-color: var(--accent); background: #f0f6fc; }
.template-card input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); }
.tpl-body { display: flex; flex-direction: column; gap: 3px; }
.tpl-name { font-size: 1.05rem; font-weight: 700; }
.tpl-desc { font-size: .88rem; color: #556; }
.tpl-meta { font-size: .8rem; color: var(--accent); font-weight: 700; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 20px;
}
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field .fl { font-size: .88rem; font-weight: 700; }
.form-field .fl em {
    font-style: normal;
    color: var(--red);
    font-size: .75rem;
    margin-left: 4px;
}
.form-field input, .form-field select {
    min-height: 46px;
    font-size: 1.05rem;
    font-family: inherit;
    padding: 6px 12px;
    border: 1px solid #aab;
    border-radius: 8px;
    background: #fff;
}
.form-actions { display: flex; justify-content: center; margin-top: 4px; }
.form-actions .btn { min-width: 260px; min-height: 52px; font-size: 1.1rem; }

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 写真モーダル ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: 12px;
    max-width: min(760px, 92vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-weight: 700;
    border-bottom: 1px solid #dde;
}
.modal-close {
    border: none;
    background: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px 10px;
}
.modal img { max-width: 100%; max-height: 60vh; object-fit: contain; background: #111; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
}
.modal-actions label.btn { cursor: pointer; }

/* ---------- アップロード中オーバーレイ ---------- */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 500;
    font-weight: 700;
    color: var(--accent);
}
.spinner {
    width: 44px; height: 44px;
    border: 4px solid #cdd9e5;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 画面幅別調整 ---------- */
/* iPad横（1024〜1220px）：シートが横スクロールなしで収まる */
@media (max-width: 1220px) {
    .container { padding: 10px 10px 40px; }
}
/* iPad縦・スマホ：シートは横スクロールで参照 */
@media (max-width: 1060px) {
    .sheet-scroll { border: 1px solid #ccd; border-radius: 6px; }
}
@media (max-width: 700px) {
    .project-card { flex-wrap: wrap; }
    .project-card .mgmt-no { min-width: auto; }
}
