:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f1ede6;
  --text: #2b2824;
  --muted: #7c756b;
  --line: #e6e0d6;
  --accent: #b5654a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6df;
  --ok: #3f7d58;
  --ok-soft: #e3f1e7;
  --warn: #9a6a10;
  --warn-soft: #fbf0d6;
  --danger: #b23b3b;
  --danger-soft: #f8e1e1;
  --c1: #b5654a; --c2: #4a7fb5; --c3: #5c9a6a; --c4: #9a6ab5; --c5: #c49a2c; --c6: #5a8f99;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 45, 30, .06), 0 2px 10px rgba(60, 45, 30, .04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 12px; letter-spacing: .02em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; }
.sub { margin-top: 16px; color: var(--muted); font-weight: 600; }
p { margin: 0 0 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* header & nav */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 6px;
  max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px;
}
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 16px; max-width: 1100px; margin: 0 auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px;
}
.nav a:hover { text-decoration: none; background: var(--surface-2); }
.nav a.active { background: var(--text); color: var(--bg); }

.main { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* blocks */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-head a { font-size: 13px; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.grid > div > .card { margin-bottom: 14px; }
@media (min-width: 760px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid.wide-left { grid-template-columns: 3fr 2fr; }
}
.grid { margin-bottom: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.narrow { max-width: 560px; }

.hello { margin: 4px 0 16px; }
.hello h1 { font-size: 24px; margin-bottom: 2px; }
.hello-date { color: var(--muted); margin: 0; font-size: 13px; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%;
  font-size: 16px; /* iOSのズーム防止 */
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > label { min-width: 0; }
.grow { flex: 1 1 140px; }
.inline-add { display: flex; gap: 8px; margin-bottom: 10px; }
.quick { display: flex; gap: 10px; align-items: flex-end; }
.quick textarea { flex: 1; }
.search input { min-width: 200px; }
.date-jump input { padding: 5px 8px; width: auto; }
.code-input { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }
.danger-text { color: var(--danger) !important; }
.btn.danger-text { border-color: transparent; background: none; padding-left: 0; }

/* misc text */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; }
.empty { color: var(--muted); font-size: 14px; margin: 6px 0; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.alert-card { border-color: var(--warn); background: var(--warn-soft); }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.5;
  padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.muted { color: var(--muted); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.dot.c1 { background: var(--c1); } .dot.c2 { background: var(--c2); } .dot.c3 { background: var(--c3); }
.dot.c4 { background: var(--c4); } .dot.c5 { background: var(--c5); } .dot.c6 { background: var(--c6); }

.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.status.s-進行中 { background: var(--accent-soft); color: var(--accent); }
.status.s-検討中 { background: var(--warn-soft); color: var(--warn); }
.status.s-完了 { background: var(--ok-soft); color: var(--ok); }

/* lists */
ul { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 5px 0; }
.tasks .task { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.tasks .task:first-child { border-top: 0; }
.task-body { flex: 1; min-width: 0; }
.task-text { word-break: break-word; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.task-meta:empty { display: none; }
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; color: var(--accent-ink); font-size: 13px; font-weight: 800; padding: 0; margin-top: 1px;
}
.check:hover { border-color: var(--accent); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task-edit { margin-top: 4px; font-size: 13px; }
.task-edit summary { color: var(--muted); cursor: pointer; display: inline-block; }
.task-edit[open] { background: var(--surface-2); padding: 10px; border-radius: 10px; }
.task-edit[open] summary { margin-bottom: 8px; }
.task-edit form + form { margin-top: 6px; }

.events .event-date { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 10px; }
.events .event-date:first-child { margin-top: 0; }
.events .event-date.is-today { color: var(--accent); }
.event, .diary-list li, .note-list li { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; }
.event-time { flex: none; min-width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 1px; }
.day-block { padding: 8px 0; border-top: 1px solid var(--line); }
.day-block:first-of-type { border-top: 0; }
.day-block.is-today h3 { color: var(--accent); }
.day-block .event-time { min-width: 92px; }
.diary-list li, .note-list li { border-top: 1px solid var(--line); padding: 9px 0; }
.diary-list li:first-child, .note-list li:first-child { border-top: 0; }
.note-date { flex: none; min-width: 84px; color: var(--muted); font-size: 13px; padding-top: 1px; }
.summary { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.day-list li { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 8px; }
.day-list li.active { background: var(--accent-soft); }
.pager { display: flex; gap: 6px; align-items: center; }

.tabs, .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a, .chips a {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; background: var(--surface);
}
.tabs a:hover, .chips a:hover { text-decoration: none; background: var(--surface-2); }
.tabs a.active, .chips a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips a.active .muted { color: inherit; opacity: .7; }
.page-head .tabs { margin: 0; }

.project-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.project-card { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--text); height: 100%; }
.project-card:hover { text-decoration: none; border-color: var(--accent); }
.project-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.project-name { font-weight: 700; margin: 6px 0 2px; }
.project-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.business-row select { width: auto; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
.memo { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); white-space: normal; }

.site-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.site-list li:first-child { border-top: 0; }
.site-main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.site-name { font-weight: 600; color: var(--text); }
.site-actions { margin-top: 4px; gap: 14px; }

/* auth */
.plain .auth { max-width: 400px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) 16px 40px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; margin-bottom: 20px; }
.auth-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; }
.qr img, .qr canvas { width: 200px; height: 200px; }
.secret summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.secret-key { display: block; font-size: 16px; padding: 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; user-select: all; }

/* ===== AIオフィス ===== */
.nav-count, .seg-count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 20px; text-align: center; font-weight: 700;
}
.office-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.seg a { padding: 7px 18px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.active { background: var(--text); color: var(--bg); }
.office-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px;
}
.stat:hover { text-decoration: none; filter: brightness(.98); }
.stat b { font-size: 20px; line-height: 1; }
.stat-wait { background: var(--warn-soft); border-color: transparent; } .stat-wait b { color: var(--warn); }
.stat-stop { background: var(--danger-soft); border-color: transparent; } .stat-stop b { color: var(--danger); }
.stat-prep b { color: var(--muted); }

.office-scroll { overflow-x: auto; border-radius: 18px; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow); }
.office-map { position: relative; min-width: 760px; aspect-ratio: 1536 / 1024; background: #f1e6da; overflow: hidden; }
.office-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.office-map [data-x] { position: absolute; }
.room-label {
  transform: translate(-50%, -50%); background: rgba(255, 255, 255, .92); color: #4a4038; font-weight: 800;
  font-size: clamp(11px, 1.15vw, 15px); padding: 4px 14px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 10px rgba(120, 90, 60, .16); z-index: 1; letter-spacing: .02em;
}
.room-label.lounge { color: #8a7f74; }

.agent {
  transform: translate(-50%, -78%); background: none; border: 0; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; color: #26282e;
}
.agent:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.avatar {
  position: relative; display: grid; place-items: center; flex: none;
  width: clamp(38px, 4.2vw, 58px); height: clamp(38px, 4.2vw, 58px); border-radius: 50%;
  color: #fff; font-weight: 800; font-size: clamp(16px, 1.9vw, 26px);
  border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .22); background: var(--muted);
  transition: transform .15s;
}
.agent:hover .avatar, .agent.selected .avatar { transform: scale(1.08); }
.avatar::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -9px; height: 9px; border-radius: 50%;
  background: rgba(120, 90, 60, .22); filter: blur(1px); z-index: -1;
}
.agent.selected .avatar { box-shadow: 0 0 0 4px var(--accent), 0 3px 10px rgba(0, 0, 0, .22); }
.c1 .avatar, .avatar.c1 { background: #e07a5f; } .c2 .avatar, .avatar.c2 { background: #5b8def; }
.c3 .avatar, .avatar.c3 { background: #5fb98a; } .c4 .avatar, .avatar.c4 { background: #c06fd6; }
.c5 .avatar, .avatar.c5 { background: #e8b23c; } .c6 .avatar, .avatar.c6 { background: #4cb8c4; }
.agent.st-preparing .avatar { filter: saturate(.35); opacity: .92; }
.avatar-count {
  position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: #e8a33c; color: #fff; font-size: 12px; line-height: 18px; border: 2px solid #fff; text-align: center;
}
.avatar-state { position: absolute; bottom: -1px; right: -1px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; background: #9aa0a6; }
.st-working .avatar-state { background: #34a853; }
.st-idle .avatar-state { background: #8ab4f8; }
.st-waiting .avatar-state { background: #f6a609; }
.st-stopped .avatar-state { background: #e5484d; }
.agent-name {
  background: rgba(255, 255, 255, .95); padding: 2px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap;
  font-size: clamp(11px, 1.1vw, 14px); box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.human .agent-name { background: #26282e; color: #fff; }
.badges { display: flex; gap: 3px; }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 6px;
  font-size: 12px; font-weight: 800; color: #fff; background: #8b8f96; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.badge.j-ok { background: #3f9b63; }
.badge.j-error { background: #e5484d; }
.badge.j-preparing, .badge.j-paused { background: #b9bcc2; }

.bubble {
  position: absolute; z-index: 30000; max-width: 260px; background: #fffdf7; color: #26282e; border-radius: 16px;
  padding: 10px 14px; box-shadow: 0 6px 24px rgba(60, 40, 10, .2); font-size: 14px; line-height: 1.6;
  transform: translate(-50%, -100%); width: max-content; animation: bubble-in .25s ease-out; pointer-events: none;
  border: 2px solid #f0dfc0;
}
.bubble::after {
  content: ""; position: absolute; left: calc(50% + var(--tail-x, 0px)); bottom: -8px; width: 14px; height: 14px; background: #fffdf7;
  border-right: 2px solid #f0dfc0; border-bottom: 2px solid #f0dfc0; transform: translateX(-50%) rotate(45deg);
}
.bubble p { margin: 0; }
.bubble-who { font-weight: 800; font-size: 12px; color: #7c756b; margin-bottom: 2px !important; }
.bubble-text { font-weight: 600; }
.bubble-note { color: #7c756b; font-size: 12px; margin-top: 6px !important; }
.bubble-note:empty { display: none; }
@keyframes bubble-in { from { opacity: 0; } to { opacity: 1; } }
.office-hint { margin: 8px 2px 14px; }

.agent-panel {
  position: fixed; z-index: 30; right: 12px; top: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
@media (max-width: 640px) {
  .agent-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 75vh; }
}
.panel-close { position: absolute; right: 10px; top: 10px; }
.panel-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 0; }
.avatar.big { width: 56px; height: 56px; font-size: 24px; }
.panel-bubble { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.job-list li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.job-list li:first-child { border-top: 0; }
.job-title { font-weight: 700; }
.warn-text { color: var(--warn); }
.pill.st-pill-working { background: var(--ok-soft); color: var(--ok); }
.pill.st-pill-waiting { background: var(--warn-soft); color: var(--warn); }
.pill.st-pill-stopped { background: var(--danger-soft); color: var(--danger); }

.dept-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.dept { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.dept h3 { font-size: 15px; }

/* 受信箱 */
.inbox-item.unread { border-left: 4px solid var(--accent); }
.inbox-item.is-done { opacity: .6; }
.inbox-head { display: flex; gap: 10px; align-items: flex-start; }
.avatar.small-av { width: 36px; height: 36px; font-size: 15px; border-width: 2px; box-shadow: none; }
.inbox-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inbox-title { font-size: 16px; margin: 4px 0 8px; }
.inbox-thumb img { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; margin-bottom: 10px; object-fit: cover; }
.inbox-body { font-size: 14px; margin-bottom: 8px; }
.inbox-reply { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 6px; }
.inbox-actions { gap: 16px; margin-top: 4px; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar:has(.avatar-img) { background: #fff; }

/* 社員とのやり取り */
.thread { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg-me { align-self: flex-end; align-items: flex-end; }
.msg-agent { align-self: flex-start; }
.msg-bubble { padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg-me .msg-bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg-agent .msg-bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.thread-form { display: flex; gap: 8px; align-items: flex-end; margin: 6px 0 4px; }
.thread-form textarea { flex: 1; }

/* AI・LINE連携 */
.howto { margin: 8px 0 12px; }
.howto summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 14px; }
.howto ol { padding-left: 20px; margin: 8px 0 0; }
.howto li { margin-bottom: 4px; }
.line-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.line-list li:first-child { border-top: 0; }
.line-head { display: flex; gap: 10px; align-items: center; }
.line-detail { margin: 6px 0 0 46px; }
.line-detail summary { cursor: pointer; color: var(--accent); }
.line-detail[open] { background: var(--surface-2); border-radius: 10px; padding: 10px; margin-left: 0; }
.line-detail .facts { margin: 8px 0; }
.copyable { user-select: all; word-break: break-all; }
.pair-code { font-size: 18px; letter-spacing: .2em; font-weight: 700; }

/* パスキー */
.passkey-login { display: flex; flex-direction: column; gap: 12px; }
.passkey-btn { padding: 14px 16px; font-size: 15px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 全身像の社員 */
.office-map { --stand-h: calc(var(--mapw, 1070px) * 0.074); --sit-h: calc(var(--mapw, 1070px) * 0.056); }
/* 立っている人は足元、座っている人はお尻(座る画像の上から約58%)を、指定した点に合わせる */
.agent.has-body { transform: translate(-50%, calc(var(--stand-h) * -1)); }
.agent.has-body.pose-sit { transform: translate(-50%, calc(var(--sit-h) * -0.58)); }
.agent.has-body.walking { transform: translate(-50%, calc(var(--stand-h) * -1)); }
.body-wrap { position: relative; display: block; line-height: 0; }
.agent-body {
  display: block; height: var(--stand-h); width: auto; user-select: none;
  filter: drop-shadow(0 2px 2px rgba(80, 55, 30, .25)); transition: transform .15s, filter .15s;
  transform-origin: 50% 100%;
}
.body-wrap::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -4px; height: 9px; border-radius: 50%;
  background: rgba(110, 80, 50, .28); filter: blur(2px); z-index: -1;
}
.agent.has-body:hover .agent-body { transform: scale(1.06); }
.agent.has-body.selected .agent-body { filter: drop-shadow(0 0 5px rgba(181, 101, 74, .95)) drop-shadow(0 2px 2px rgba(80, 55, 30, .25)); }
.agent.has-body.st-preparing .agent-body { filter: saturate(.55) drop-shadow(0 2px 2px rgba(80, 55, 30, .25)); }
.body-wrap .avatar-count { top: -2px; right: -10px; }
.body-wrap .avatar-state { top: 6px; bottom: auto; right: -4px; }
.agent.has-body .agent-name { margin-top: 2px; font-size: clamp(10px, 0.95vw, 13px); padding: 1px 8px; }
.agent.has-body .badge { min-width: 18px; height: 18px; font-size: 11px; }

/* 姿勢の切り替え(ふだん: 座る/立つ、仕事中: 歩く) */
.agent .pose-walk { display: none; }
.agent.walking .pose-idle { display: none; }
.agent.walking .pose-walk { display: block; }
/* 歩く画像は左向き。右へ進むときだけ反転 */
.agent.walking.facing-right .pose-walk { transform: scaleX(-1); }
.agent.moving { transition: left 3.2s ease-in-out, top 3.2s ease-in-out; }
.agent.walking .body-wrap { animation: walk-step .5s ease-in-out infinite alternate; }
@keyframes walk-step { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.agent.pose-sit .agent-body.pose-idle { height: var(--sit-h); }
.agent.pose-sit .body-wrap::after { display: none; }
@media (prefers-reduced-motion: reduce) { .agent.moving { transition: none; } .agent.walking .body-wrap { animation: none; } }

.yes-no { display: flex; gap: 8px; margin: 4px 0 6px; }
.yes-no .btn { min-width: 84px; }

/* 家計簿 */
.kakeibo-pager { margin-bottom: 12px; }
.kakeibo-total { font-size: 30px; font-weight: 800; margin-bottom: 12px; }
.bars li { display: grid; grid-template-columns: 80px 1fr 90px; gap: 10px; align-items: center; padding: 4px 0; font-size: 14px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 140px; }
.trend li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.trend-bar { width: 60%; background: var(--line); border-radius: 6px 6px 0 0; }
.trend li.active .trend-bar { background: var(--accent); }

.budget-meter { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.budget-meter .bar-fill { background: var(--ok); }
.budget-meter.warn .bar-fill { background: var(--warn); }
.budget-meter.over .bar-fill { background: var(--danger); }
.budget-meter.over .small { color: var(--danger); font-weight: 700; }
.fixed-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.fixed-list li:first-child { border-top: 0; }
.fixed-list li.inactive { opacity: .55; }
.fixed-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fixed-form input, .fixed-form select { width: auto; padding: 6px 8px; }
.fixed-form .grow { flex: 1 1 160px; }
.w-amount { width: 100px !important; } .w-day { width: 52px !important; }
.fixed-memo { margin: 4px 0 0; }
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

.kakeibo-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.kakeibo-alert { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.kakeibo-alert.over { background: var(--danger-soft); color: var(--danger); }
.view-main { padding-top: calc(16px + env(safe-area-inset-top)); }

/* 隣の人と名札が重なる人は、名札を頭の上に出す */
.agent.label-top .agent-name, .agent.label-top .badges { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.agent.label-top .agent-name { bottom: calc(100% + 2px); }
.agent.label-top .badges { bottom: calc(100% + 24px); }

.msg-image img { display: block; max-width: 180px; max-height: 220px; border-radius: 12px; object-fit: cover; }
