/* NAOSITE — 一覧・設定などの画面の見た目（編集画面 /app/ と同じ色・角丸・影にそろえる）
   方針: 白い面と細い線、ポイントカラーは緑(#206B53)の1色だけ。動きは「現れる・持ち上がる・光る」を短く。
   ダーク: OS の設定に合わせる。画面右上の切り替え（data-theme）で上書きできる。 */
:root {
    --bg: rgb(245, 247, 246);
    --bg-dot: rgba(15, 23, 42, .055);
    --panel: #ffffff;
    --panel-2: #f3f6f4;
    --hover: #eef2f0;
    --line: #e2e8e5;
    --line-strong: #cfd8d3;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --faint: #9ca3af;
    --primary: #206B53;
    --primary-dark: #17503e;
    --primary-soft: #e8f2ee;
    --primary-line: #b4d3c7;
    --primary-glow: rgba(32, 107, 83, .16);
    --primary-light: #5fa88f;
    --red: #e11d48;
    --red-soft: #fff1f3;
    --green: #16a34a;
    --green-soft: #effdf4;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --glass-bar: rgba(255, 255, 255, .78);
    --radius: 14px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 10px 24px -8px rgba(30, 41, 80, .16), 0 2px 6px rgba(15, 23, 42, .05);
    --shadow-lg: 0 24px 60px -12px rgba(30, 41, 80, .28);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --appbar-h: 60px;
    /* 旧来の名前（各画面の style 属性・旧画面が使う）。新しい色に合わせて残す */
    --bg-dark: var(--bg);
    --bg-card: var(--panel);
    --bg-card-hover: var(--hover);
    --text-main: var(--text);
    --text-muted: var(--muted);
    --primary-hover: var(--primary-dark);
    --accent: var(--red);
    --confirmed: #2170d8;
    --success: var(--green);
    --glass: var(--panel-2);
    --glass-border: var(--line);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d1015; --bg-dot: rgba(255, 255, 255, .045); --panel: #151920; --panel-2: #1b2028; --hover: #222833;
        --line: #272d38; --line-strong: #363e4c; --text: #e7eaf0; --text-2: #c7ccd6; --muted: #98a1b0; --faint: #6b7483;
        --primary: #3fa180; --primary-dark: #9fdcc6; --primary-soft: #14271f; --primary-line: #29594a; --primary-glow: rgba(63, 161, 128, .22); --primary-light: #7cc9ad;
        --red: #fb7185; --red-soft: #3a1d24; --green: #4ade80; --green-soft: #15291d; --amber: #fbbf24; --amber-soft: #33270f;
        --glass-bar: rgba(13, 16, 21, .72);
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
        --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0d1015; --bg-dot: rgba(255, 255, 255, .045); --panel: #151920; --panel-2: #1b2028; --hover: #222833;
    --line: #272d38; --line-strong: #363e4c; --text: #e7eaf0; --text-2: #c7ccd6; --muted: #98a1b0; --faint: #6b7483;
    --primary: #3fa180; --primary-dark: #9fdcc6; --primary-soft: #14271f; --primary-line: #29594a; --primary-glow: rgba(63, 161, 128, .22); --primary-light: #7cc9ad;
    --red: #fb7185; --red-soft: #3a1d24; --green: #4ade80; --green-soft: #15291d; --amber: #fbbf24; --amber-soft: #33270f;
    --glass-bar: rgba(13, 16, 21, .72);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Geist', 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
    font-size: 15px;
    background-color: var(--bg);
    /* うっすらとした点の格子と、上の方の淡い光（平らすぎない背景） */
    background-image:
        radial-gradient(1200px 420px at 15% -10%, var(--primary-glow), transparent 70%),
        radial-gradient(var(--bg-dot) 1px, transparent 1px);
    background-size: auto, 22px 22px;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    overflow-x: clip; /* 100vw の帯がスクロールバー分はみ出さないように */
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-soft); color: var(--primary-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 40px) 64px;
}

/* ---------------------------------------------------------------- アプリバー（上に貼り付く・すりガラス） */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: var(--appbar-h);
    margin: 0 calc(50% - 50vw) 28px; /* .container の幅を越えて、画面の端から端まで */
    padding: 10px clamp(16px, 3vw, 40px);
    background: var(--glass-bar);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; font-size: 15px; }
.logo-mark {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .08);
    transition: transform .4s var(--ease);
}
.logo-mark svg { width: 22px; height: 22px; }
.brand:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }

.bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; color: var(--text-2); max-width: 280px;
}
.user-chip .avatar {
    width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; font-weight: 700; font-size: 13px;
}
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); transition: color .2s; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { color: var(--faint); }
.crumbs strong { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }

/* ---------------------------------------------------------------- ページの見出し */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { font-size: 13px; font-weight: 600; color: var(--primary); letter-spacing: .06em; margin-bottom: 6px; }
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; text-wrap: balance; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 62ch; text-wrap: pretty; }

/* ---------------------------------------------------------------- ボタン */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text-2);
    cursor: pointer;
    font: 600 13px/1 inherit;
    font-family: inherit;
    white-space: nowrap;
    transition: background .2s var(--ease), border-color .2s var(--ease), color .2s, transform .15s var(--ease), box-shadow .2s;
    box-shadow: none;
}
.btn:hover { border-color: var(--line-strong); background: var(--hover); color: var(--text); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-primary {
    background: var(--primary); border-color: transparent; color: #fff;
    box-shadow: none;
}
.btn-primary:hover { background: var(--primary-dark); border-color: transparent; color: #fff; box-shadow: none; }
:root[data-theme="dark"] .btn-primary:hover { color: #0d1015; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-icon { width: 36px; padding: 0; }

/* ---------------------------------------------------------------- カード・面 */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .25s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }

/* カーソルの位置だけ縁が光る（.spot に --mx・--my を api.js が入れる） */
.spot { position: relative; isolation: isolate; }
.spot::before {
    content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
    background: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), var(--primary), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .3s;
}
.spot:hover::before { opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

/* ---------------------------------------------------------------- 統計のタイル（ダッシュボードの上） */
.stats { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
@media (max-width: 960px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stats .hero { grid-column: 1 / -1; }
    .stat { min-height: 0; padding: 12px 14px; gap: 4px; }
    .stat .value { font-size: 24px; }
    .stat:not(.hero) .sub { display: none; }
}
.stat {
    position: relative; overflow: hidden;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow-xs); min-height: 112px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .label svg { width: 15px; height: 15px; color: var(--faint); }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat.hero { flex-direction: row; align-items: center; gap: 18px; justify-content: flex-start;
    background: linear-gradient(135deg, var(--panel) 40%, var(--primary-soft)); }
.stat.hero .ring { flex: 0 0 auto; }
.ring { --p: 0; width: 76px; height: 76px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--primary); stroke-dasharray: 201; stroke-dashoffset: calc(201 - 201 * var(--p) / 100); transition: stroke-dashoffset 1.2s var(--ease); }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 1s var(--ease); }
.meter.done i { background: linear-gradient(90deg, var(--green), #86efac); }

/* ---------------------------------------------------------------- 一覧の上の道具（検索・絞り込み） */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; line-height: 20px; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input[type="search"] {
    height: 36px; width: min(280px, 60vw); padding: 0 12px 0 34px; margin: 0;
    border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text);
    font: inherit; font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color .2s, box-shadow .2s, width .35s var(--ease);
}
.search input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); width: min(340px, 70vw); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.seg button {
    height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--muted);
    font: 600 12.5px/1 inherit; font-family: inherit; cursor: pointer; transition: background .2s, color .2s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- プロジェクト・画面のカード */
.project-item { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.project-item:hover { transform: translateY(-3px); }
.project-item > a { display: flex; flex-direction: column; height: 100%; color: inherit; }
.thumb { position: relative; height: 168px; overflow: hidden; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .8s var(--ease); }
.project-item:hover .thumb img { transform: scale(1.04); }
.thumb.empty { display: grid; place-items: center; color: var(--faint);
    background: repeating-linear-gradient(135deg, var(--panel-2) 0 10px, var(--panel) 10px 20px); }
.thumb.empty svg { width: 34px; height: 34px; opacity: .7; }
.thumb .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .35), transparent 45%); opacity: 0; transition: opacity .3s; }
.project-item:hover .thumb .shade { opacity: 1; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-name { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--text); word-break: break-word; padding-right: 0; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
    background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.chip svg { width: 12px; height: 12px; }
.chip.blue { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-line); }
.chip.green { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.chip.red { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-row .meter { flex: 1; }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--faint); }
.comment-count-tag { font-size: 13px; color: var(--muted); font-weight: 600; display: inline-block; }
.project-date { font-size: 12.5px; color: var(--faint); }

/* 済・確 のはんこ */
.stamp {
    position: absolute; top: 12px; left: 12px; z-index: 3; width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center; font-size: 20px; font-weight: 900; background: rgba(255, 255, 255, .92);
    border: 3px solid currentColor; box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    opacity: 0; animation: stamp-pop .5s var(--ease) .3s forwards;
}
.stamp.done { color: #e11d48; }
.stamp.ok { color: var(--primary); left: 64px; animation-delay: .45s; }
@keyframes stamp-pop { from { opacity: 0; transform: rotate(14deg) scale(2.2); } to { opacity: 1; transform: rotate(10deg) scale(1); } }

/* カードの右上の小さな操作（編集・削除）。乗ったときだけ出る */
.edit-btn-top, .delete-btn-top {
    position: absolute; top: 10px; width: 30px; height: 30px; z-index: 10;
    display: grid; place-items: center; border-radius: 8px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .25); color: #fff;
    background: rgba(17, 24, 39, .55); backdrop-filter: blur(6px);
    opacity: 0; transform: translateY(-4px); transition: opacity .25s, transform .3s var(--ease), background .2s;
}
.edit-btn-top { right: 46px; }
.delete-btn-top { right: 10px; }
.project-item:hover .edit-btn-top, .project-item:hover .delete-btn-top,
.project-item:focus-within .edit-btn-top, .project-item:focus-within .delete-btn-top { opacity: 1; transform: none; }
.edit-btn-top:hover { background: var(--primary); }
.delete-btn-top:hover { background: var(--red); }

/* 新しく作るカード（一覧の最初） */
.new-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px;
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--muted);
    cursor: pointer; font: inherit; font-weight: 600; transition: border-color .25s, color .25s, background .25s, transform .35s var(--ease);
}
.new-card .plus { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); transition: transform .4s var(--ease); }
.new-card .plus svg { width: 22px; height: 22px; }
.new-card:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 50%, transparent); transform: translateY(-3px); }
.new-card:hover .plus { transform: rotate(90deg); }
.new-card small { font-weight: 500; font-size: 13px; color: var(--faint); }

/* 空のとき・読み込み中 */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 56px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.empty-state h3 { color: var(--text); font-size: 17px; margin: 12px 0 6px; }
.empty-state .icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-state .icon svg { width: 26px; height: 26px; }
.empty-state .btn { margin-top: 16px; }
.skeleton { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; height: 290px; position: relative; }
.skeleton::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--line) 60%, transparent) 50%, transparent 80%);
    transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
.skeleton.stat-sk { height: 112px; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* 現れる動き（--i の順に少しずつ遅らせる） */
.reveal { opacity: 0; animation: rise .6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
    .reveal { opacity: 1; }
}

/* お知らせの帯 */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 20px; font-size: 14px;
    background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--text-2); }
.notice a { color: var(--amber); text-decoration: underline; }
.notice.blue { background: var(--primary-soft); border-color: var(--primary-line); }
.notice.green { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }

/* ---------------------------------------------------------------- 小窓（モーダル） */
.modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(10, 14, 24, .42); backdrop-filter: blur(6px);
    justify-content: center; align-items: center; padding: 16px;
    animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-content {
    background: var(--panel); color: var(--text);
    padding: 24px; border-radius: 18px; border: 1px solid var(--line);
    width: 440px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .06);
    animation: modal-in .35s var(--ease);
}
.modal-content h2 { font-size: 18px; letter-spacing: -0.02em; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* PDF（指示書のプレビュー）の窓: 指示書のページを中に出し、「PDF として保存（印刷）」と「閉じる」を窓に置く */
.pdf-modal-content { width: min(980px, 100%); height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow: hidden; }
.pdf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pdf-actions { display: flex; gap: 8px; }
.pdf-modal-content .pane-note { margin: 0; }
.pdf-modal-content iframe { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); background: rgb(245, 247, 246); }

/* ---------------------------------------------------------------- 入力欄 */
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="file"], input[type="url"], input[type="search"], textarea, select {
    font-family: inherit;
    accent-color: var(--primary);
}
input[type="text"], input[type="file"], input[type="url"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0 12px;
    min-height: 40px;
    margin: 12px 0;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
}
textarea { padding: 10px 12px; }
input[type="file"] { padding: 8px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary) !important; box-shadow: 0 0 0 4px var(--primary-glow); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { color: var(--text); background: var(--panel); }

.field { display: block; margin-bottom: 14px; }
.field > label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select { margin: 0; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
.field.readonly input { background: var(--panel-2); color: var(--muted); }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }
.field-row > .grow { flex: 2; }

.panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.panel .panel-desc { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.panel-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 設定・マイページ: 幅いっぱいを使う 2 列（パネルは列の途中で割れない） */
.cols { columns: 2 460px; column-gap: 20px; }
.cols > .panel { break-inside: avoid; margin-bottom: 20px; }
.cols .member-add-grid { grid-template-columns: 1fr 1fr; }
.cols .member-add-grid .btn { grid-column: 1 / -1; justify-self: end; }
.page-head .head-actions { display: flex; gap: 8px; align-items: center; }
.panel > h3 { display: flex; align-items: center; gap: 8px; }
.panel > h3 svg { width: 18px; height: 18px; color: var(--primary); flex: 0 0 auto; }
.panel .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel .sub-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 2000; box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.2)); }
.toast.show { opacity: 1; }
.inline-msg { font-size: 13.5px; margin-top: 8px; }
.inline-msg.ok { color: var(--green); }
.inline-msg.err { color: var(--red); }

.badge-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.badge-pill.ok { color: var(--green); background: var(--green-soft); }
.badge-pill.warn { color: var(--amber); background: var(--amber-soft); }
.badge-pill.role { color: var(--primary); background: var(--primary-soft); }

.member-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px;
}
.member-row .m-main { min-width: 0; overflow: hidden; }
.member-row .m-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row .m-email { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-add-grid { display: grid; grid-template-columns: 1fr 1.4fr 1fr auto; gap: 8px; align-items: end; }
.member-add-grid .field { margin-bottom: 0; }
@media (max-width: 640px) { .member-add-grid { grid-template-columns: 1fr; } }

.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status-chip.on .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

/* 登録の窓の中の選択肢（URL・貼り付け・ファイル） */
.source-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 14px; }
.source-tabs button {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 600 12.5px/1.2 inherit; font-family: inherit; cursor: pointer;
    transition: border-color .2s, color .2s, background .2s, transform .2s var(--ease);
}
.source-tabs button svg { width: 20px; height: 20px; }
.source-tabs button:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.source-tabs button.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-glow); }
.source-pane { animation: rise .35s var(--ease); }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border-radius: 12px; text-align: center;
    border: 1.5px dashed var(--line-strong); background: var(--panel-2); color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.dropzone svg { width: 26px; height: 26px; }
kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--panel); color: var(--text-2); }
.form-error { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 1em; }

/* 処理中（URL の撮影など）の帯 */
#capture-progress { background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 20px; display: none; }

/* テーマの切り替え */
.theme-toggle svg { transition: transform .5s var(--ease); }
.theme-toggle:hover svg { transform: rotate(40deg); }

@media (max-width: 640px) {
    header { gap: 8px; }
    .bar-actions .hide-sm { display: none; }
    .page-head h1 { font-size: 1.5rem; }
    .grid { grid-template-columns: 1fr; }
}

/* ================================================================ 旧画面（画像に直接ピン・コメント: image.html ほか）の部品 */
.comment-txt { display: block; margin-top: .5rem; }
.image-container { position: relative; max-width: 100%; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); margin-bottom: 4px; box-shadow: var(--shadow-xs); }
.image-container img { display: block; max-width: 100%; cursor: crosshair; }
.pins-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.pin-box { position: absolute; border: 2px solid var(--accent); background: rgba(232, 80, 109, .14); z-index: 5; pointer-events: auto; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.pin-box.resolved { border-color: #98a0b3; background: rgba(152, 160, 179, .12); }
.pin-box.confirmed { border-color: var(--confirmed); background: rgba(47, 127, 224, .13); }
.pin-number { position: absolute; top: 5px; left: 5px; width: 24px; height: 24px; background: var(--accent); border: 2px solid white; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(31, 37, 51, .35); pointer-events: none; z-index: 200; }
.resolved .pin-number { background: #98a0b3; }
.confirmed .pin-number { background: var(--confirmed); }
.drag-box { position: absolute; border: 2px dashed var(--primary); background: rgba(79, 102, 240, .15); display: none; z-index: 100; pointer-events: none; border-radius: 3px; }
.comment-list { margin-top: 2rem; display: grid; gap: 1rem; }
.comment-item { background: var(--panel); padding: 1.1rem 1.2rem; border-radius: var(--radius-md); position: relative; display: flex; flex-direction: column; gap: .6rem; transition: all .2s ease; border: 1px solid var(--line); border-left: 3px solid var(--accent); box-shadow: var(--shadow-xs); }
.comment-item.resolved, .comment-item.resolved ~ .comment-replies { opacity: .6; }
.comment-item.resolved, .comment-item.resolved ~ .comment-replies .comment-item { border-left-color: #98a0b3; }
.comment-item.confirmed, .comment-item.confirmed ~ .comment-replies { opacity: .6; }
.comment-item.confirmed, .comment-item.confirmed ~ .comment-replies .comment-item { border-left-color: var(--confirmed); }
.comment-badge { background: var(--primary); color: white; font-size: .85rem; font-weight: 800; padding: 4px 9px; border-radius: 6px; margin-right: 4px; }
.comment-text { flex-grow: 1; word-break: break-all; font-size: .95rem; color: var(--text); line-height: 1.5; }
.comment-actions { display: flex; gap: 4px; align-items: center; }
.attachment-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.attachment-tag { background: var(--panel-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 6px; font-size: .73rem; color: var(--muted); display: flex; align-items: center; gap: 4px; transition: all .15s ease; }
.attachment-tag:hover { background: var(--primary); border-color: var(--primary); color: white; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--faint); transition: all .15s ease; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--green); }
.icon-btn.danger:hover { color: var(--accent) !important; background: var(--red-soft); }
.comment-thread { margin-bottom: .5rem; }
.root-comment { border-bottom: 1px solid var(--line); padding-bottom: 1.2rem; margin-bottom: 1.2rem; }
.root-comment:last-child { border-bottom: none; }
.comment-footer { display: flex; justify-content: flex-end; margin-top: 4px; }
.comment-time { font-size: .68rem; color: var(--muted); }
.resize-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 1px solid var(--primary); z-index: 100; border-radius: 50%; box-shadow: 0 2px 4px rgba(31, 37, 51, .3); }
.resize-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resize-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.resize-handle.n { top: -6px; left: 50%; margin-left: -6px; cursor: n-resize; }
.resize-handle.s { bottom: -6px; left: 50%; margin-left: -6px; cursor: s-resize; }
.resize-handle.e { right: -6px; top: 50%; margin-top: -6px; cursor: e-resize; }
.resize-handle.w { left: -6px; top: 50%; margin-top: -6px; cursor: w-resize; }
@keyframes stamp-in { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(10deg) scale(2.5); } 100% { opacity: 1; transform: translate(-50%, -50%) rotate(10deg) scale(1); } }

/* ---------------------------------------------------------------- サイドバー（プロジェクト・プロジェクト・アカウント） */
:root { --side-w: 264px; --gut: clamp(16px, 3vw, 40px); }
.side-toggle { display: none; }
.sidebar, .side-scrim { display: none; }
@media (min-width: 981px) {
    body.has-side .container { max-width: none; padding-left: calc(var(--side-w) + var(--gut)); padding-right: var(--gut); }
    body.has-side header { margin-left: calc(-1 * (var(--side-w) + var(--gut))); margin-right: calc(-1 * var(--gut)); padding-left: var(--gut); padding-right: var(--gut); }
    body.has-side main { max-width: 1280px; }
    .sidebar {
        display: flex; flex-direction: column; position: fixed; z-index: 40; top: var(--appbar-h); bottom: 0; left: 0; width: var(--side-w);
        padding: 0; background: var(--panel); border-right: 1px solid var(--line);
    }
}
@media (max-width: 980px) {
    body.has-side .side-toggle { display: inline-flex; }
    body.has-side .sidebar {
        display: flex; flex-direction: column; position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); padding: 0;
        background: var(--panel); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
        transform: translateX(-102%); transition: transform .3s var(--ease);
    }
    body.has-side.side-open .sidebar { transform: none; }
    body.has-side .side-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(8, 20, 15, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
    body.has-side.side-open .side-scrim { opacity: 1; pointer-events: auto; }
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; padding: 18px 12px 16px; }
.side-link { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 14.5px; font-weight: 500; transition: background .15s, color .15s; }
.side-link svg, .side-new svg, .side-fold svg { width: 17px; height: 17px; flex: 0 0 auto; }
.side-link svg { color: var(--muted); }
.side-link small { margin-left: auto; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--faint); }
.side-link:hover, .side-row:hover, .side-screen:hover, .side-new:hover { background: var(--hover); color: var(--text); }
.side-link.on, .side-screen.on, .side-proj.current > .side-row { background: var(--hover); color: var(--text); }
.side-link.on { font-weight: 600; }
.side-body { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.side-row { display: flex; align-items: center; border-radius: 8px; transition: background .15s; }
.side-fold { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: none; cursor: pointer; color: var(--muted); }
.side-fold:hover { color: var(--text); }
.side-name { flex: 1; min-width: 0; display: block; padding: 6px 10px 6px 0; line-height: 22px; font-size: 14.5px; font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-proj.current > .side-row .side-name { color: var(--text); font-weight: 600; }
.side-screens { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 6px; }
.side-screens[hidden] { display: none; }
.side-screen { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 5px 10px 5px 34px; border-radius: 8px; font-size: 14px; color: var(--text-2); transition: background .15s; }
.side-screen.on { font-weight: 600; }
.side-screen span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.side-screen em { font-style: normal; flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-top { position: relative; display: flex; align-items: center; gap: 2px; }
.side-top .side-link { flex: 1; min-width: 0; }
.side-sort { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.side-sort svg { width: 17px; height: 17px; }
.side-sort:hover, .side-sort[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.side-sortmenu { position: absolute; z-index: 6; top: calc(100% + 4px); right: 0; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); box-shadow: var(--shadow-md); }
.side-sortmenu[hidden] { display: none; }
.side-sortmenu .side-mi.on::after { content: '✓'; margin-left: auto; color: var(--primary); font-weight: 700; }
.side-add, .side-pin { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; margin-right: 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.side-add svg, .side-pin svg { width: 16px; height: 16px; }
.side-row:hover .side-pin, .side-row:hover .side-add, .side-pin:focus-visible, .side-add:focus-visible { opacity: 1; }
.side-add:hover, .side-pin:hover { background: var(--line); color: var(--text); }
.side-add { margin-right: 0; }
.side-pin.on { opacity: 1; color: var(--primary); }
.side-pin.on svg { fill: currentColor; }
.side-row.dragging { opacity: .4; }
.side-row.drop-before { box-shadow: 0 -2px 0 var(--primary); }
.side-row.drop-after { box-shadow: 0 2px 0 var(--primary); }
@media (hover: none) { .side-pin, .side-add { opacity: 1; } }
.side-new { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; transition: background .15s, color .15s; }
.side-empty { padding: 6px 12px; font-size: 13px; color: var(--muted); }
.side-label { margin: 16px 12px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--faint); }

/* サイドバーの一番下: アカウント（よくある、押すと上にメニューが開く形） */
.side-foot { position: relative; flex: 0 0 auto; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.side-me { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; font: inherit; color: var(--text); text-align: left; transition: background .15s; }
.side-me:hover, .side-me[aria-expanded="true"] { background: var(--hover); }
.side-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 14px; }
.side-me-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 600; }
.side-me-name em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 4px; }
.side-me-chev { flex: 0 0 auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-135deg); margin: 3px 4px 0 0; transition: transform .2s var(--ease); }
.side-me[aria-expanded="true"] .side-me-chev { transform: rotate(45deg); margin-top: -3px; }
.side-menu { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 5; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); box-shadow: var(--shadow-md); }
.side-menu[hidden] { display: none; }
.side-mi-head { padding: 8px 10px 6px; font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 14.5px; color: var(--text); text-align: left; border-radius: 8px; }
.side-mi svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--muted); }
.side-mi:hover { background: var(--hover); }
.side-mi.on { background: var(--panel-2); font-weight: 700; }
.side-mi-sep { height: 1px; margin: 4px 0; background: var(--line); }
