/* ===== TIMELINE 旅のきろく ===== */

/* ---------- テーマ ---------- */
:root, [data-theme="pastel"] {
  --bg: #fdf7f3;
  --bg-deco: radial-gradient(circle at 12% 18%, rgba(246,165,192,.22), transparent 38%),
             radial-gradient(circle at 88% 12%, rgba(169,223,207,.25), transparent 35%),
             radial-gradient(circle at 70% 90%, rgba(198,184,242,.22), transparent 40%);
  --paper: #ffffff;
  --paper-2: #faf4fb;
  --ink: #4a4358;
  --muted: #9b91a9;
  --line: #f0e6ef;
  --accent: #f08aab;
  --accent-ink: #ffffff;
  --accent-soft: rgba(240,138,171,.14);
  --accent-2: #7fcfb9;
  --gold: #f5b97f;
  --shadow: 0 10px 30px rgba(150, 110, 150, .14);
  --radius: 18px;
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Noto Sans JP", sans-serif;
  --font-body: "Zen Maru Gothic", "Noto Sans JP", "Hiragino Sans", sans-serif;
  --font-latin: "Montserrat", var(--font-body);
  --tile-filter: none;
  --texture: none;
  --logo-1: #f6a5c0; --logo-2: #a9dfcf; --logo-3: #c6b8f2; --logo-4: #ffd2a8;
  color-scheme: light;
}
[data-theme="washi"] {
  --bg: #efe5d0; --bg-deco: none;
  --paper: #faf5ea; --paper-2: #f3ead8;
  --ink: #2b2118; --muted: #7d6c58; --line: #dccdb2;
  --accent: #b7282e; --accent-ink: #fffaf2; --accent-soft: rgba(183,40,46,.1);
  --accent-2: #4f7a5a; --gold: #a8844c;
  --shadow: 0 10px 30px rgba(70,45,20,.16);
  --radius: 10px;
  --font-display: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --tile-filter: sepia(.18) saturate(.9);
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --logo-1: #b7282e; --logo-2: #a8844c; --logo-3: #4f7a5a; --logo-4: #2b2118;
  color-scheme: light;
}
[data-theme="modern"] {
  --bg: #f4f5f7; --bg-deco: none;
  --paper: #ffffff; --paper-2: #f6f7f9;
  --ink: #1c2230; --muted: #6b7280; --line: #e4e6eb;
  --accent: #2f6fe4; --accent-ink: #ffffff; --accent-soft: rgba(47,111,228,.1);
  --accent-2: #14a37f; --gold: #8a8f99;
  --shadow: 0 8px 28px rgba(20,28,45,.12);
  --radius: 14px;
  --font-display: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --tile-filter: none; --texture: none;
  --logo-1: #2f6fe4; --logo-2: #14a37f; --logo-3: #1c2230; --logo-4: #9aa3b5;
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #0c1226; --bg-deco: radial-gradient(circle at 80% 0%, rgba(216,181,104,.12), transparent 40%);
  --paper: #141c36; --paper-2: #1a2342;
  --ink: #efe8d6; --muted: #98a1bb; --line: #2a3558;
  --accent: #e2553e; --accent-ink: #fff6ea; --accent-soft: rgba(226,85,62,.16);
  --accent-2: #d8b568; --gold: #d8b568;
  --shadow: 0 12px 34px rgba(0,0,0,.45);
  --radius: 12px;
  --font-display: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --tile-filter: none; --texture: none;
  --logo-1: #e2553e; --logo-2: #d8b568; --logo-3: #5b6ea8; --logo-4: #efe8d6;
  color-scheme: dark;
}

/* ---------- 基本 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); background-image: var(--bg-deco), var(--texture);
  color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: .03em; }
.muted { color: var(--muted); }

/* ロゴ（4つのタイル） */
.logo { width: 36px; height: 36px; flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; transform: rotate(-6deg); }
.logo i { border-radius: 30%; background: var(--logo-1); }
.logo i:nth-child(2) { background: var(--logo-2); }
.logo i:nth-child(3) { background: var(--logo-3); }
.logo i:nth-child(4) { background: var(--logo-4); }
.logo-lg { width: 60px; height: 60px; margin: 0 auto 14px; gap: 5px; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-weight: 700; transition: transform .1s, background .15s; text-decoration: none; color: var(--ink);
}
[data-theme="washi"] .btn, [data-theme="night"] .btn { border-radius: var(--radius); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--accent); border-color: var(--accent); background: transparent; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--paper); border-radius: 50%; cursor: pointer; color: var(--ink); flex: none; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--accent); }

/* ---------- フォーム ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
.field input, .field textarea, .field select, .filters input, .filters select, .time-window input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 6px);
  background: var(--paper); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus, .time-window input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; }
.form-error { color: var(--accent); font-size: 13px; margin: 0 0 12px; font-weight: 700; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap .seg-btn { flex: 1 1 45%; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: calc(var(--radius) - 5px); cursor: pointer; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.seg-btn.is-on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cat-grid button { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: calc(var(--radius) - 6px); border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink); }
.cat-grid button i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; }
.cat-grid button.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.time-window { display: flex; align-items: flex-end; gap: 8px; }
.time-window label { flex: 1; min-width: 0; }
.time-window small { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.time-window input { padding: 9px 8px; font-size: 14px; }
.tw-arrow { padding-bottom: 10px; color: var(--muted); }
.tw-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.tw-dur { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--accent); }
.visit-row { display: flex; gap: 6px; align-items: center; }
.visit-row input { flex: 1; min-width: 0; }
.visit-row .chip { padding: 8px 14px; font-size: 13px; font-weight: 700; }
.opt-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 700; cursor: pointer; }
.opt-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.left-opt { margin-top: 8px; padding: 10px; border-radius: calc(var(--radius) - 6px); background: var(--paper-2); border: 1px dashed var(--line); }
.visit-when { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.visit-when b { font-family: var(--font-display); font-size: 17px; }
.visit-when .t { font-family: var(--font-latin); font-weight: 800; font-size: 20px; }
.visit-when small { color: var(--muted); font-weight: 700; font-size: 13px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.is-on { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- ログイン ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); padding: 32px 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 2px; font-size: 30px; letter-spacing: .12em; font-family: var(--font-latin); font-weight: 800; }
.auth-card p { margin: 0 0 20px; font-size: 14px; }
.auth-card .seg { margin-bottom: 18px; }
.auth-card form { text-align: left; }

/* ---------- レイアウト ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 1100;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-family: var(--font-latin); font-weight: 800; letter-spacing: .14em; font-size: 17px; line-height: 1.2; }
.brand-sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-mid { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; min-width: 0; }
.trip-select { max-width: 240px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); font-weight: 700; font-size: 14px; min-width: 0; }
.btn-tt { padding: 8px 14px; background: linear-gradient(120deg, var(--logo-1), var(--logo-3)); border: 0; color: #fff; font-family: var(--font-latin); letter-spacing: .08em; font-size: 13px; box-shadow: 0 4px 14px var(--accent-soft); }
[data-theme="washi"] .btn-tt, [data-theme="night"] .btn-tt { background: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 8px; position: relative; margin-left: auto; }

/* テーマ選択（ボタン1つ → ホバー/タップで4つ） */
.theme-pick { position: relative; }
.theme-current { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; }
.theme-current i, .theme-pop i { width: 20px; height: 20px; border-radius: 50%; display: block; flex: none; }
[data-theme="pastel"] .theme-current i, .theme-pop [data-theme-btn="pastel"] i { background: conic-gradient(#f6a5c0 0 25%, #a9dfcf 0 50%, #c6b8f2 0 75%, #ffd2a8 0); }
[data-theme="washi"] .theme-current i, .theme-pop [data-theme-btn="washi"] i { background: #b7282e; box-shadow: inset 0 0 0 3px #f3ead8, 0 0 0 1px #dccdb2; }
[data-theme="modern"] .theme-current i, .theme-pop [data-theme-btn="modern"] i { background: #fff; box-shadow: inset 0 0 0 1.5px #1c2230; }
[data-theme="night"] .theme-current i, .theme-pop [data-theme-btn="night"] i { background: #141c36; box-shadow: inset 0 0 0 3px #d8b568; }
.theme-pop { position: absolute; right: -6px; top: 100%; padding-top: 8px; display: none; z-index: 1250; }
.theme-pop::before { content: ""; position: absolute; inset: 8px 0 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: -1; }
.theme-pop > * { position: relative; }
.theme-pop-title { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 14px 2px; }
.theme-pop button { display: flex; align-items: center; gap: 10px; width: 190px; padding: 9px 14px; border: 0; background: transparent; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink); text-align: left; }
.theme-pop button:last-child { margin-bottom: 6px; }
.theme-pop button:hover { background: var(--paper-2); }
.theme-pop button.is-on::after { content: "✓"; margin-left: auto; color: var(--accent); }
@media (hover: hover) { .theme-pick:hover .theme-pop { display: block; } }
.theme-pick.is-open .theme-pop { display: block; }

.menu { position: absolute; right: 0; top: 46px; min-width: 210px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 1200; }
.menu-head { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--paper-2); }

.stage { flex: 1; position: relative; overflow: hidden; }
.map { position: absolute; inset: 0; background: var(--paper-2); }
.leaflet-tile-pane { filter: var(--tile-filter); }
.leaflet-container { font-family: var(--font-body); background: var(--paper-2); }
.leaflet-control-attribution { font-size: 10px; }
[data-theme="night"] .leaflet-control-attribution { background: rgba(12,18,38,.7) !important; color: #98a1bb; }
[data-theme="night"] .leaflet-control-attribution a { color: #d8b568; }
.leaflet-control-zoom a { background: var(--paper) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-bottom.leaflet-left { margin-bottom: 76px; }

.searchbox { position: absolute; top: 12px; left: 12px; z-index: 900; width: min(360px, calc(100% - 24px - 52px)); display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 11px 0; color: var(--ink); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; padding: 4px; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); font-weight: 700; }
.search-results button:hover { background: var(--paper-2); }
.search-results small { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 400; }
.search-results .empty { padding: 10px; font-size: 13px; color: var(--muted); }

.map-btn { position: absolute; top: 12px; right: 12px; z-index: 900; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; color: var(--ink); }

.fab { position: absolute; z-index: 950; left: 16px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 13px 20px 13px 16px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; box-shadow: 0 8px 22px var(--accent-soft), 0 2px 6px rgba(0,0,0,.12); cursor: pointer; }
.fab-plus { font-size: 20px; line-height: 1; }

.pickbar { position: absolute; z-index: 960; left: 50%; top: 66px; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px 10px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-weight: 700; }
.pickbar .btn { background: var(--paper); color: var(--ink); border-color: transparent; }
.pickbar .btn-ghost { background: transparent; color: var(--paper); border-color: rgba(255,255,255,.35); }
.pickbar-actions { display: flex; gap: 6px; }
.map.is-picking { cursor: crosshair; }

/* ---------- パネル ---------- */
.panel { position: absolute; z-index: 1000; top: 12px; right: 12px; bottom: 12px; width: 390px; margin-top: 52px; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); overflow: hidden; }
[data-theme="washi"] .panel { background-image: var(--texture); }
.panel > div { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel-grip { display: none; }
.panel-body { flex: 1; overflow: auto; padding: 4px 14px 90px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 14px 14px 10px; }
.stat { text-align: center; padding: 8px 2px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-latin); font-size: 20px; line-height: 1.15; color: var(--accent); font-weight: 800; }
[data-theme="washi"] .stat b, [data-theme="night"] .stat b { font-family: var(--font-display); }
.stat span { font-size: 11px; color: var(--muted); font-weight: 700; }
[data-theme="pastel"] .stat:nth-child(2) b { color: #5fbfa4; }
[data-theme="pastel"] .stat:nth-child(3) b { color: #9d88e6; }
[data-theme="pastel"] .stat:nth-child(4) b { color: #ee9f5a; }
.seg-tabs { margin: 0 14px 10px; }
.filters { display: flex; gap: 6px; padding: 0 14px 10px; }
.filters input { flex: 1; padding: 8px 12px; border-radius: 999px; }
.filters select { width: 120px; padding: 8px; border-radius: 999px; }

.empty-state { text-align: center; padding: 36px 12px; color: var(--muted); font-size: 14px; }
.empty-state .logo { margin: 0 auto 12px; opacity: .6; }

/* タイムライン */
.day-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; gap: 8px; padding: 10px 2px 6px; background: var(--paper); }
[data-theme="washi"] .day-head { background: var(--paper); }
.day-head b { font-family: var(--font-display); font-size: 17px; }
.day-head small { color: var(--muted); font-size: 12px; }
.tl-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); cursor: pointer; margin-bottom: 4px; position: relative; color: var(--ink); }
.tl-item:hover { border-color: var(--accent); }
.tl-tools { display: flex; justify-content: flex-end; padding: 2px 0 4px; }
.tl-tools button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 6px; }
.tl-tools button:hover { color: var(--accent); }
.tl-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; align-self: center; display: grid; place-items: center; font-size: 13px; color: #fff; background: var(--paper); }
.tl-item.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.tl-item.is-checked .tl-check { background: var(--accent); border-color: var(--accent); }
.bulk-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.bulk-bar span { font-size: 13px; font-weight: 700; margin-right: auto; }
.bulk-del { background: #e0566f; border-color: #e0566f; }
.trip-tracks { margin: -2px 0 10px; display: flex; flex-direction: column; gap: 4px; }
.trip-track { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--paper-2); border-radius: 10px; padding: 4px 6px 4px 10px; }
.trip-track span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-track button { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 24px; height: 24px; border-radius: 50%; }
.trip-track button:hover { background: var(--accent-soft); color: var(--accent); }
.tl-item .cat-dot { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 17px; flex: none; }
.tl-main { min-width: 0; flex: 1; }
.tl-time { font-family: var(--font-latin); font-size: 12px; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-dur { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 8px; font-family: var(--font-body); }
.tl-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-thumbs { display: flex; gap: 4px; margin-top: 6px; }
.tl-thumbs span { width: 46px; height: 46px; border-radius: 10px; overflow: hidden; background: var(--paper-2); position: relative; flex: none; }
.tl-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-thumbs .more { display: grid; place-items: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.play-badge { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }
.tl-move { display: flex; align-items: center; gap: 6px; padding: 2px 0 6px 26px; font-size: 12px; color: var(--muted); }
.tl-move::before { content: ""; width: 2px; height: 18px; background: repeating-linear-gradient(var(--line) 0 4px, transparent 4px 7px); margin-right: 8px; }
.trip-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.trip-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 旅 */
.trip-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 10px; background: var(--paper); position: relative; overflow: hidden; cursor: pointer; }
.trip-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--trip, var(--accent)); }
.trip-card.is-on { border-color: var(--trip, var(--accent)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--trip, var(--accent)) 30%, transparent); }
.trip-card h3 { margin: 0; font-family: var(--font-display); font-size: 17px; }
.trip-meta { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.trip-strip { display: flex; gap: 4px; margin-bottom: 10px; overflow: hidden; }
.trip-strip img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.trip-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.new-trip { width: 100%; margin: 4px 0 12px; border-style: dashed; }

/* アルバム */
.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 4px; }
.album button { padding: 0; border: 0; background: var(--paper-2); border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 1; position: relative; }
.album img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album .dur { position: absolute; right: 5px; bottom: 5px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 0 5px; border-radius: 6px; font-family: var(--font-latin); }

/* 詳細 */
.detail-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.detail-head .back { border: 0; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); padding: 4px 6px; font-weight: 700; }
.detail-body { flex: 1; overflow: auto; padding: 16px 16px 90px; }
.cat-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; color: #4a4358; }
.detail-title { font-family: var(--font-display); font-size: 24px; font-weight: 900; line-height: 1.3; margin: 8px 0 6px; }
.time-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); margin: 10px 0; }
.time-card .t { font-family: var(--font-latin); font-weight: 800; font-size: 20px; line-height: 1.1; }
.time-card small { display: block; font-size: 11px; color: var(--muted); font-family: var(--font-body); font-weight: 700; }
.time-card .arrow { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); position: relative; }
.time-card .arrow b { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); font-size: 11px; background: var(--paper-2); padding: 0 6px; color: var(--accent); white-space: nowrap; }
.detail-meta { font-size: 13px; color: var(--muted); }
.detail-memo { white-space: pre-wrap; background: var(--paper-2); border-radius: 16px; padding: 12px; font-size: 14px; margin: 12px 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
/* 写真・動画は元の縦横比のまま並べる（切れない） */
.media-grid { columns: 2; column-gap: 6px; margin-top: 8px; }
.media-grid.is-single { columns: 1; }
.media-grid button { display: block; width: 100%; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--paper-2); cursor: zoom-in; aspect-ratio: var(--ar, 1); position: relative; margin: 0 0 6px; break-inside: avoid; }
.media-grid .dur { position: absolute; right: 6px; bottom: 6px; font-size: 11px; color: #fff; background: rgba(0,0,0,.55); padding: 0 6px; border-radius: 6px; font-family: var(--font-latin); }
/* 枠に収める表示：前面は全体が見えるように、背面は同じ写真をぼかして余白を埋める */
.fitbox { position: absolute; inset: 0; overflow: hidden; background: var(--paper-2); }
.fitbox .fit-bg { position: absolute; inset: -12%; width: 124%; height: 124%; object-fit: cover; filter: blur(16px) saturate(1.1); opacity: .55; }
.fitbox .fit-fg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.fitbox .fit-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.section-label { font-size: 12px; color: var(--muted); margin-top: 16px; font-weight: 700; letter-spacing: .06em; }

/* ---------- マーカー ---------- */
.pin { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; border: 3px solid var(--paper); box-shadow: 0 3px 10px rgba(80,60,90,.3); position: relative; transition: transform .2s; }
.pin:hover { transform: scale(1.12); }
.pin.has-media::after { content: ""; position: absolute; right: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper); }
.pin-temp { animation: bob 1s ease-in-out infinite alternate; border-style: dashed; }
@keyframes bob { to { transform: translateY(-6px); } }
.route-line { stroke-dasharray: 2 9; stroke-linecap: round; }
.leaflet-tooltip { border-radius: 10px; font-weight: 700; font-family: var(--font-body); }

/* ---------- 編集シート ---------- */
dialog.sheet { width: min(540px, calc(100% - 24px)); max-height: calc(100% - 40px); padding: 0; border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
dialog.sheet-sm { width: min(420px, calc(100% - 24px)); }
dialog.sheet-wide { width: min(980px, calc(100% - 24px)); }
dialog.sheet::backdrop { background: rgba(60, 40, 70, .35); backdrop-filter: blur(2px); }
.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 19px; }
.sheet-body { padding: 16px; overflow: auto; flex: 1; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.loc-btn { justify-content: flex-start; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; cursor: pointer; line-height: 1; }
.thumb.is-new::after { content: "NEW"; position: absolute; left: 4px; top: 4px; font-size: 9px; font-weight: 800; background: var(--accent); color: var(--accent-ink); padding: 0 5px; border-radius: 5px; font-family: var(--font-latin); }
.thumb .prog { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); width: 0; transition: width .2s; }
.upload-btn { cursor: pointer; border-style: dashed; }

/* ---------- カード作成 ---------- */
.card-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px; max-height: calc(100vh - 110px); overflow: auto; }
.card-preview { display: grid; place-items: center; background: var(--paper-2); border-radius: 16px; padding: 16px; min-height: 300px; background-image: linear-gradient(45deg, rgba(0,0,0,.03) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.03) 75%), linear-gradient(45deg, rgba(0,0,0,.03) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.03) 75%); background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.card-preview canvas { max-width: 100%; max-height: calc(100vh - 180px); width: auto; height: auto; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.card-photos { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.card-photos button { flex: none; width: 58px; height: 58px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: var(--paper-2); }
.card-photos button.is-on { border-color: var(--accent); }
.card-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }

/* ---------- ビューア ---------- */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(20, 14, 24, .94); display: grid; place-items: center; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: max(64px, env(safe-area-inset-top)) 16px max(72px, env(safe-area-inset-bottom)); }
.lb-stage img, .lb-stage video { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 8px; background: #000; }
.lb-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; cursor: pointer; z-index: 2; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 28px; cursor: pointer; z-index: 2; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-caption { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #eee; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 4000; background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* =================================================================
   TIMETILE
   ================================================================= */
body.tt-mode .panel, body.tt-mode .fab, body.tt-mode .searchbox, body.tt-mode .map-btn,
body.tt-mode .leaflet-control-zoom { display: none !important; }
body.tt-mode .topbar-mid { visibility: hidden; }
.tt { position: absolute; inset: 0; z-index: 1050; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.tt > * { pointer-events: auto; }
.tt-top { display: flex; align-items: flex-start; gap: 10px; padding: 12px; }
.tt-title { background: var(--paper); border-radius: 16px; padding: 8px 14px; box-shadow: var(--shadow); min-width: 0; max-width: 50%; }
.tt-badge { font-family: var(--font-latin); font-weight: 800; font-size: 10px; letter-spacing: .2em; background: linear-gradient(90deg, var(--logo-1), var(--logo-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tt-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-clock { margin-left: auto; background: var(--ink); color: var(--paper); border-radius: 16px; padding: 8px 14px; font-family: var(--font-latin); font-weight: 800; font-size: 20px; line-height: 1.1; text-align: right; box-shadow: var(--shadow); white-space: nowrap; }
.tt-clock small { display: block; font-size: 11px; font-weight: 600; opacity: .75; font-family: var(--font-body); }
.tt-close { width: 42px; height: 42px; box-shadow: var(--shadow); }

.tt-card { position: absolute; left: 12px; top: 84px; width: min(300px, calc(100% - 24px)); background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; animation: ttCardIn .45s cubic-bezier(.2,1.3,.4,1); }
@keyframes ttCardIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.tt-card .ph { height: 160px; display: flex; gap: 2px; background: var(--paper-2); }
.tt-card .ph .fitbox { position: relative; flex: 1; min-width: 0; height: 100%; }
.tt-card .bd { padding: 10px 14px 12px; }
.tt-card .nm { font-family: var(--font-display); font-weight: 900; font-size: 18px; line-height: 1.3; }
.tt-card .tm { font-family: var(--font-latin); font-weight: 700; font-size: 13px; color: var(--muted); }
.tt-card .mv { padding: 12px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tt-card .mv b { font-family: var(--font-display); }
.tt-card.summary .bd { text-align: center; padding: 18px; }
.tt-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.tt-sum div { background: var(--paper-2); border-radius: 12px; padding: 6px 2px; }
.tt-sum b { display: block; font-family: var(--font-latin); font-size: 18px; color: var(--accent); }
.tt-sum span { font-size: 10px; color: var(--muted); font-weight: 700; }

.tt-bottom { padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
.tt-controls { display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); margin-bottom: 8px; }
.tt-btn { border: 0; background: var(--paper-2); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 15px; color: var(--ink); flex: none; }
.tt-play { width: 46px; height: 46px; background: var(--accent); color: var(--accent-ink); font-size: 18px; }
.tt-chip { width: auto; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 13px; font-family: var(--font-latin); }
.tt-chip.is-on { background: var(--accent-soft); color: var(--accent); }
#ttSeek { flex: 1; min-width: 60px; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; outline: none;
  background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); }
#ttSeek::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 4px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: pointer; }
#ttSeek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 4px solid var(--accent); cursor: pointer; }
.tt-tiles { display: flex; gap: 8px; overflow-x: auto; padding: 10px 4px 6px; scroll-behavior: smooth; scrollbar-width: none; }
.tt-tiles::-webkit-scrollbar { display: none; }
.tt-tile { flex: none; width: 128px; border: 0; padding: 0; text-align: left; border-radius: 16px; background: var(--paper); box-shadow: 0 4px 14px rgba(0,0,0,.1); overflow: hidden; cursor: pointer; opacity: .62; transform: scale(.94); transition: opacity .3s, transform .3s, box-shadow .3s; color: var(--ink); }
.tt-tile .im { height: 64px; background: var(--paper-2); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.tt-tile .im img { width: 100%; height: 100%; object-fit: cover; }
.tt-tile .tx { padding: 6px 9px 8px; }
.tt-tile .tm { font-family: var(--font-latin); font-size: 10px; font-weight: 700; color: var(--muted); }
.tt-tile .nm { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-tile.is-done { opacity: .9; transform: none; }
.tt-tile.is-active { opacity: 1; transform: translateY(-4px); box-shadow: 0 0 0 3px var(--accent), 0 10px 22px rgba(0,0,0,.18); }

.tt-traveler { width: 22px; height: 22px; border-radius: 50%; background: var(--tt, var(--accent)); border: 3px solid #fff; box-shadow: 0 0 0 0 var(--tt, var(--accent)); animation: ttPulse 1.4s infinite; }
@keyframes ttPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tt, #f08aab) 60%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.tt-stop { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-latin); font-weight: 800; font-size: 13px; background: var(--paper); color: var(--muted); border: 2px dashed var(--line); transform: scale(.7); opacity: .7; transition: all .35s cubic-bezier(.2,1.4,.4,1); }
.tt-stop.is-reached { transform: scale(1); opacity: 1; background: var(--tt, var(--accent)); color: #fff; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.tt-stop.is-now { transform: scale(1.25); }
.tt-ripple { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--tt, var(--accent)); animation: ttRipple 1.2s ease-out forwards; }
@keyframes ttRipple { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.tt-preview { stroke-dasharray: 3 10; stroke-linecap: round; animation: ttDash 1.2s linear infinite; }
@keyframes ttDash { to { stroke-dashoffset: -26; } }

/* ---------- スマホ ---------- */
@media (max-width: 860px) {
  .card-wrap { grid-template-columns: 1fr; }
  .card-preview canvas { max-height: 52vh; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .logo { width: 30px; height: 30px; }
  .topbar-mid { order: 3; flex-basis: 100%; justify-content: stretch; }
  .trip-select { flex: 1; max-width: none; }
  .topbar-right { margin-left: auto; }
  .theme-switch button { width: 26px; height: 26px; }
  .theme-switch button i { width: 15px; height: 15px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; margin: 0; height: 46%; border-radius: 22px 22px 0 0; border-bottom: 0; transition: height .25s ease; }
  .panel.is-collapsed { height: 64px; }
  .panel.is-expanded { height: calc(100% - 16px); }
  .panel-grip { display: block; flex: none; height: 22px; border: 0; background: transparent; cursor: pointer; padding: 0; }
  .panel-grip span { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 9px auto 0; }
  .stats { padding-top: 4px; }
  .stat b { font-size: 17px; }
  .fab { left: auto; right: 14px; bottom: calc(46% + 14px); transition: bottom .25s ease; padding: 12px 16px 12px 13px; }
  .stage.is-collapsed .fab { bottom: 78px; }
  .stage.is-expanded .fab { display: none; }
  .leaflet-bottom { bottom: 46%; }
  .leaflet-bottom.leaflet-left { margin-bottom: 0; }
  .stage.is-collapsed .leaflet-bottom { bottom: 64px; }
  .stage.is-expanded .leaflet-bottom { display: none; }
  body.tt-mode .leaflet-bottom { bottom: 0; display: block; }
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 94%; }
  .sheet form { max-height: 94vh; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-grid button { padding: 7px 6px; font-size: 12px; }
  .time-window { flex-direction: column; align-items: stretch; gap: 6px; }
  .tw-arrow { display: none; }
  .tt-title { max-width: 55%; }
  .tt-clock { font-size: 16px; }
  .tt-card { top: auto; bottom: 200px; left: 12px; width: calc(100% - 24px); display: flex; }
  .tt-card .ph { width: 110px; height: auto; flex: none; }
  .tt-card.summary { display: block; }
  .tt-tile { width: 110px; }
}


/* =================================================================
   ゲスト表示・ログインポップアップ
   ================================================================= */
body.is-guest .member-only { display: none !important; }
body:not(.is-guest) .guest-only { display: none !important; }
.map-btn-2 { top: 12px; right: 64px; }
@media (max-width: 760px) { .map-btn-2 { top: 64px; right: 12px; } body:not(.is-guest) .map-btn-2 { top: 12px; right: 64px; } body:not(.is-guest) .searchbox { width: calc(100% - 24px - 104px); } }
.guest-card { position: absolute; z-index: 950; left: 16px; bottom: 24px; width: min(420px, calc(100% - 32px)); display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.guest-text { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.guest-text b { display: block; font-family: var(--font-display); font-size: 17px; color: var(--ink); }
body.is-guest .leaflet-bottom.leaflet-left { margin-bottom: 104px; }
.auth-dialog { padding: 0; border: 0; background: transparent; max-width: calc(100% - 24px); width: 400px; overflow: visible; }
.auth-dialog::backdrop { background: rgba(60, 40, 70, .35); backdrop-filter: blur(3px); }
.auth-dialog .auth-card { position: relative; animation: ttCardIn .35s cubic-bezier(.2,1.3,.4,1); }
.auth-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; }

/* 期間タグ */
.period-chips { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.period-chips::-webkit-scrollbar { display: none; }
.period-chips button { flex: none; border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.period-chips button small { font-family: var(--font-latin); font-size: 10px; margin-left: 4px; opacity: .8; }
.period-chips button.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* =================================================================
   記録の管理（表＋地図）
   ================================================================= */
.manage { position: absolute; inset: 0; z-index: 1080; background: var(--bg); display: flex; flex-direction: column; }
.manage-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.manage-head h2 { margin: 0 6px 0 0; font-size: 18px; }
.manage-head input, .manage-head select { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); font-size: 13px; }
.manage-head input { width: 220px; }
.m-count { font-size: 12px; color: var(--muted); font-weight: 700; }
.m-spacer { flex: 1; }
.manage-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.m-table-wrap { overflow: auto; background: var(--paper); border-right: 1px solid var(--line); }
.m-map-wrap { position: relative; }
.m-hint { font-size: 11px; color: var(--muted); padding: 6px 14px; background: var(--paper); border-top: 1px solid var(--line); }
.m-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.m-table th { position: sticky; top: 0; z-index: 2; background: var(--paper-2); color: var(--muted); font-weight: 700; text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; font-size: 12px; }
.m-table th:hover { color: var(--ink); }
.m-table th .arr { color: var(--accent); margin-left: 4px; }
.m-table th.c-check, .m-table td.c-check { width: 34px; text-align: center; cursor: default; position: sticky; left: 0; z-index: 1; }
.m-table th.c-check { z-index: 3; }
.m-table td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--paper); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.m-table td > .cell { padding: 7px 10px; min-height: 34px; overflow: hidden; text-overflow: ellipsis; }
.m-table td.editable { cursor: cell; }
.m-table td.editable:hover { background: var(--paper-2); }
.m-table td.num { text-align: right; font-family: var(--font-latin); font-variant-numeric: tabular-nums; }
.m-table tr.is-active td { background: var(--accent-soft); }
.m-table tr.is-active td.c-check { box-shadow: inset 3px 0 0 var(--accent); }
.m-table tr.is-saving td { opacity: .5; }
.m-table td.is-editing { padding: 0; overflow: visible; }
.m-table td.is-editing input, .m-table td.is-editing select { width: 100%; min-width: 140px; border: 2px solid var(--accent); border-radius: 0; padding: 6px 8px; font-size: 13px; background: var(--paper); outline: none; }
.m-table .cat-mini { display: inline-flex; align-items: center; gap: 4px; }
.m-table .cat-mini i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; }
.m-table .row-actions { display: flex; gap: 2px; padding: 3px 6px; }
.m-table .row-actions button { border: 0; background: transparent; cursor: pointer; border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.m-table .row-actions button:hover { background: var(--paper-2); }
.m-empty { padding: 40px; text-align: center; color: var(--muted); }
.pin.is-hl { transform: scale(1.35); box-shadow: 0 0 0 4px var(--accent), 0 4px 12px rgba(0,0,0,.3); z-index: 1000; }

/* アカウント設定 */
.acct-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.acct-summary div { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px; text-align: center; }
.acct-summary b { display: block; font-family: var(--font-latin); color: var(--accent); font-size: 17px; }
.acct-summary span { font-size: 11px; color: var(--muted); font-weight: 700; }
.acct-summary .wide { grid-column: span 3; text-align: left; font-size: 13px; }
.acct-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.acct-section h3 { margin: 0 0 10px; font-size: 15px; font-family: var(--font-display); }
.acct-note { font-size: 11px; margin: 8px 0 0; }

@media (max-width: 860px) {
  .manage-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr); }
  .m-table-wrap { border-right: 0; border-bottom: 1px solid var(--line); }
  .manage-head input { width: 100%; order: 10; }
  .manage-head h2 { font-size: 16px; }
  .m-hint { display: none; }
}
@media (max-width: 760px) {
  .guest-card { bottom: 16px; left: 12px; width: calc(100% - 24px); }
  body.is-guest .leaflet-bottom { bottom: 0; }
  body.is-guest .leaflet-bottom.leaflet-left { margin-bottom: 110px; }
}


/* 地図の下地（Google マップ風） */
.map, .leaflet-container { background: #f5f5f2; }
[data-mapmode="night"] .map, [data-mapmode="night"] .leaflet-container { background: #1d2c4d; }
[data-mapmode="night"] .leaflet-tile-pane { filter: none; }
[data-mapmode="night"][data-maptype="raster"] .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) saturate(.5) brightness(.85) contrast(.9); }
[data-mapmode="night"] .leaflet-control-attribution { background: rgba(29,44,77,.75) !important; color: #8ea3c4; }
[data-mapmode="night"] .leaflet-control-attribution a { color: #8ec3b9; }
.leaflet-pane .leaflet-gl-layer, .leaflet-pane canvas.maplibregl-canvas { outline: none; }
