:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-2: #eef3f5;
  --ink: #182026;
  --muted: #69747c;
  --line: #dbe3e6;
  --accent: #176b6f;
  --accent-strong: #0f5558;
  --accent-soft: #d9eeee;
  --warn: #d8942f;
  --shadow: 0 12px 28px rgba(19, 36, 42, 0.08);
  --topbar-height: 44px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  font-family:
    Inter, "Segoe UI", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

body.login-active {
  /* 縦は許可（スマホの縦積みレイアウトで下のログインフォームに届くように）。
     デスクトップは 100vh に収まるためスクロールバーは出ない */
  overflow-x: hidden;
  overflow-y: auto;
}

body.login-active > .app-shell,
body.login-active > .context-menu,
body.login-active > .modal-backdrop,
body.login-active > .progress-overlay {
  display: none !important;
}

body:not(.login-active) > .login-screen {
  display: none;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 440px);
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(19, 38, 44, 0.94), rgba(18, 63, 66, 0.9)),
    #13262c;
}

.login-visual {
  display: grid;
  position: relative;
  overflow: hidden;
  align-items: center;
  min-height: 100vh;
  padding: 52px clamp(36px, 6vw, 96px);
}

/* 図面グリッド。ゆっくり流して奥行きを出す */
.login-visual::before {
  content: "";
  position: absolute;
  inset: -44px;
  background:
    linear-gradient(rgba(238, 247, 246, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 247, 246, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: login-grid-drift 24s linear infinite;
}

/* アクセントの光だまり */
.login-visual::after {
  content: "";
  position: absolute;
  top: -18%;
  left: -10%;
  width: 62%;
  height: 72%;
  background: radial-gradient(circle, rgba(77, 217, 214, 0.15), transparent 65%);
  animation: login-glow-float 9s ease-in-out infinite alternate;
  pointer-events: none;
}

/* ノードを結ぶネットワーク（KNOT の表現）。線が描かれ、結節点が明滅する */
.login-knot-net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.login-knot-net .knot-lines path {
  fill: none;
  stroke: rgba(77, 217, 214, 0.32);
  stroke-width: 1.6;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: knot-line-draw 2.6s ease forwards;
}

.login-knot-net .knot-lines path:nth-child(2) { animation-delay: 0.5s; }
.login-knot-net .knot-lines path:nth-child(3) { animation-delay: 0.9s; }
.login-knot-net .knot-lines path:nth-child(4) { animation-delay: 1.3s; }

.login-knot-net .knot-nodes circle {
  fill: #4dd9d6;
  opacity: 0;
  animation: knot-node-in 0.6s ease forwards, knot-node-pulse 3.6s ease-in-out 2.4s infinite;
}

.login-knot-net .knot-nodes circle:nth-child(1) { animation-delay: 0.3s, 2.4s; }
.login-knot-net .knot-nodes circle:nth-child(2) { animation-delay: 0.5s, 2.8s; }
.login-knot-net .knot-nodes circle:nth-child(3) { animation-delay: 0.7s, 3.2s; }
.login-knot-net .knot-nodes circle:nth-child(4) { animation-delay: 0.9s, 2.6s; }
.login-knot-net .knot-nodes circle:nth-child(5) { animation-delay: 1.1s, 3s; }
.login-knot-net .knot-nodes circle:nth-child(6) { animation-delay: 1.3s, 2.5s; }
.login-knot-net .knot-nodes circle:nth-child(7) { animation-delay: 1.5s, 3.4s; }
.login-knot-net .knot-nodes circle:nth-child(8) { animation-delay: 1.7s, 2.9s; }

/* 左の主役: 巨大ワードマーク */
.login-hero {
  display: grid;
  position: relative;
  z-index: 1;
  gap: 16px;
  max-width: 760px;
}

.login-hero-eyebrow {
  color: rgba(238, 247, 246, 0.6);
  font-size: clamp(12px, 1.2vw, 14px);
  font-weight: 800;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  opacity: 0;
  animation: hero-fade-up 0.7s ease 0.12s forwards;
}

.login-wordmark {
  display: grid;
  font-weight: 900;
  line-height: 0.94;
}

.login-word {
  display: flex;
}

.login-word span {
  display: inline-block;
  font-size: clamp(72px, 10.5vw, 168px);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(0.35em);
  filter: blur(6px);
  background: linear-gradient(115deg, #eef7f6 0%, #eef7f6 38%, #8ceae7 50%, #eef7f6 62%, #eef7f6 100%);
  background-size: 260% 100%;
  background-position: 130% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation:
    hero-letter-rise 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    hero-shimmer 7.5s linear 3.4s infinite;
}

.login-word:nth-child(1) span:nth-child(1) { animation-delay: 0.22s, 3.4s; }
.login-word:nth-child(1) span:nth-child(2) { animation-delay: 0.3s, 3.4s; }
.login-word:nth-child(1) span:nth-child(3) { animation-delay: 0.38s, 3.4s; }
.login-word:nth-child(1) span:nth-child(4) { animation-delay: 0.46s, 3.4s; }
.login-word:nth-child(2) span:nth-child(1) { animation-delay: 0.58s, 3.4s; }
.login-word:nth-child(2) span:nth-child(2) { animation-delay: 0.66s, 3.4s; }
.login-word:nth-child(2) span:nth-child(3) { animation-delay: 0.74s, 3.4s; }

/* O だけ「結び目」としてアクセント色＋グロー */
.login-word .knot-o {
  background: none;
  -webkit-text-fill-color: #4dd9d6;
  animation:
    hero-letter-rise 0.72s cubic-bezier(0.16, 1, 0.3, 1) 0.38s forwards,
    knot-o-glow 3.4s ease-in-out 2.8s infinite;
}

.login-tagline {
  margin: 12px 0 0;
  color: #eef7f6;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 800;
  letter-spacing: 0.06em;
  opacity: 0;
  animation: hero-fade-up 0.8s ease 1.05s forwards;
}

.login-subcopy {
  margin: 0;
  max-width: 560px;
  color: rgba(238, 247, 246, 0.72);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.9;
  opacity: 0;
  animation: hero-fade-up 0.8s ease 1.25s forwards;
}

.login-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.login-feature-pills span {
  padding: 8px 14px;
  border: 1px solid rgba(77, 217, 214, 0.38);
  border-radius: 999px;
  color: #bfeeed;
  background: rgba(77, 217, 214, 0.08);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  animation: hero-fade-up 0.6s ease forwards;
}

.login-feature-pills span:nth-child(1) { animation-delay: 1.45s; }
.login-feature-pills span:nth-child(2) { animation-delay: 1.55s; }
.login-feature-pills span:nth-child(3) { animation-delay: 1.65s; }
.login-feature-pills span:nth-child(4) { animation-delay: 1.75s; }
.login-feature-pills span:nth-child(5) { animation-delay: 1.85s; }

@keyframes hero-letter-rise {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}

@keyframes knot-o-glow {
  0%, 100% { text-shadow: 0 0 18px rgba(77, 217, 214, 0.3); }
  50% { text-shadow: 0 0 44px rgba(77, 217, 214, 0.85); }
}

@keyframes knot-line-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes knot-node-in {
  to { opacity: 1; }
}

@keyframes knot-node-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes login-grid-drift {
  to { background-position: 44px 44px; }
}

@keyframes login-glow-float {
  from { transform: translate(0, 0); }
  to { transform: translate(7%, 9%); }
}

@media (prefers-reduced-motion: reduce) {
  .login-screen *,
  .login-screen *::before,
  .login-screen *::after {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 100vh;
  padding: 56px;
  background: #fff;
}

/* 右パネルは順に滑り込む（操作を妨げないよう短い遅延に留める） */
.login-panel > * {
  opacity: 0;
  transform: translateX(16px);
  animation: panel-slide-in 0.5s ease forwards;
}

.login-panel > *:nth-child(1) { animation-delay: 0.12s; }
.login-panel > *:nth-child(2) { animation-delay: 0.19s; }
.login-panel > *:nth-child(3) { animation-delay: 0.26s; }
.login-panel > *:nth-child(4) { animation-delay: 0.33s; }
.login-panel > *:nth-child(5) { animation-delay: 0.4s; }
.login-panel > *:nth-child(6) { animation-delay: 0.47s; }

@keyframes panel-slide-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.login-panel h1 {
  margin: 6px 0 10px;
  font-size: 34px;
  line-height: 1.15;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: #4f5a61;
  font-size: 12px;
  font-weight: 800;
}

.login-panel input[type="email"],
.login-panel input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfc;
  font-size: 14px;
}

.login-panel input:focus {
  outline: 2px solid rgba(23, 107, 111, 0.18);
  border-color: #74b8b9;
  background: #fff;
}

.login-options {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.login-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.login-options button {
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.login-submit {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.login-submit:hover {
  background: var(--accent-strong);
}

.login-note {
  padding-top: 4px;
  font-size: 12px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

body.drawing-mode {
  overflow: hidden;
}

body.drawing-mode .app-shell {
  grid-template-columns: 1fr;
  padding-top: 0;
}

body.drawing-mode .sidebar {
  display: none;
}

body.drawing-mode.drawing-menu-open .sidebar {
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  width: min(320px, 86vw);
  box-shadow: 18px 0 38px rgba(19, 36, 42, 0.28);
}

body.drawing-mode .workspace {
  min-height: 100vh;
}

body.drawing-mode .view {
  padding: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  min-height: 0;
  padding: 22px;
  color: #eef7f6;
  background: #13262c;
}

.sidebar .brand {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: opacity 0.15s;
}

.brand:hover {
  opacity: 0.8;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #1f7477;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
}

.brand-subtitle,
.small-text {
  color: rgba(238, 247, 246, 0.64);
  font-size: 12px;
}

.project-block {
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.project-block h1 {
  margin: 6px 0 8px;
  font-size: 22px;
  line-height: 1.35;
}

.project-block p {
  margin: 0;
  color: rgba(238, 247, 246, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #7ed7d6;
}

.explorer {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  flex: 1;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  font-size: 13px;
}

.explorer::-webkit-scrollbar {
  width: 8px;
}

.explorer::-webkit-scrollbar-thumb {
  border: 2px solid #13262c;
  border-radius: 999px;
  background: rgba(238, 247, 246, 0.24);
}

.explorer-folder-row {
  display: flex;
  align-items: center;
  position: relative;
}

.explorer-folder-row .explorer-folder {
  flex: 1;
  width: auto;
  min-width: 0;
  overflow: hidden;
}

.explorer-root,
.explorer-folder,
.explorer-file {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  color: rgba(238, 247, 246, 0.8);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}

.explorer-root:hover,
.explorer-folder:hover,
.explorer-file:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
}

/* 選択中フォルダ（現在の作業フォルダ）— 控えめな白背景で示す */
.explorer-folder.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
}

/* 開いているアイテム（今表示中の図面/写真帳/ノード）— ティールのアクセントバーで強調 */
.explorer-root.active,
.explorer-file.active {
  color: #fff;
  background: rgba(77, 217, 214, 0.16);
  border-color: transparent;
  box-shadow: inset 3px 0 0 #4dd9d6;
}

.explorer-root {
  font-weight: 800;
}

/* 現場（project）ノード */
.explorer-project {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 4px;
}

.explorer-node:first-child > .explorer-folder-row > .explorer-project {
  border-top: none;
  margin-top: 0;
}


.explorer-group {
  display: grid;
  gap: 2px;
}

.explorer-node {
  display: grid;
  gap: 2px;
}

.explorer-children {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 2px;
  position: relative;
  margin-left: 10px;
  padding-left: 0;
}

.explorer-node.collapsed > .explorer-children {
  display: none;
}

.explorer-empty {
  margin-left: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  color: rgba(238, 247, 246, 0.46);
  font-size: 12px;
}

.explorer-empty.drag-over {
  position: relative;
}

.explorer-empty.drag-over::before {
  content: "";
  position: absolute;
  left: 0;
  right: 8px;
  top: -2px;
  height: 3px;
  border-radius: 999px;
  background: #4dd9d6;
}

.explorer-node.dragging {
  opacity: 0.45;
}

.explorer-node.drag-over {
  position: relative;
}

.explorer-node.drag-over::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 8px;
  top: -2px;
  height: 3px;
  border-radius: 999px;
  background: #4dd9d6;
}


.explorer-folder {
  grid-template-columns: 24px minmax(0, 1fr);
}

.explorer-file {
  grid-template-columns: 24px minmax(0, 1fr);
}

.explorer-root span:last-child,
.explorer-folder span:last-child,
.explorer-file span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-icon,
.file-icon {
  display: grid;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 4px;
  color: #dff7f5;
  background: rgba(255, 255, 255, 0.12);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.folder-icon {
  color: #8ed8d5;
  background: transparent;
  font-size: 12px;
}

.folder-icon svg {
  display: block;
}

.explorer-project {
  grid-template-columns: 24px minmax(0, 1fr) !important;
  font-weight: 800;
  font-size: 13px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* 2つ目以降の現場は上に余白＋区切り線でセクションとして分離する */
.explorer-node + .explorer-node .explorer-project {
  margin-top: 18px;
}

/* ファイルアイコン — 種別ごとの色 */
.file-icon-drawing {
  background: #3b6fd4;
  color: #e8f0ff;
}

.file-icon-book {
  background: #c47a1a;
  color: #fff5e0;
}

.file-icon-search {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(238, 247, 246, 0.7);
}

.file-icon svg {
  display: block;
  width: 13px;
  height: 13px;
}

.lucide-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-sprite symbol {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-menu {
  position: fixed;
  z-index: 20;
  width: 168px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.context-menu button {
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
  background: transparent;
}

.context-menu button:hover {
  background: #f1f5f5;
}

.context-menu button.danger-menu-item,
#deleteFolderButton:not(:disabled) {
  color: #c4382a;
}

.context-menu button.danger-menu-item:hover,
#deleteFolderButton:not(:disabled):hover {
  background: #fff4f2;
}

.context-menu button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: transparent;
}

.menu-divider {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--line, #e5e5e5);
}

#folderAddMenu button {
  color: #1a1a1a;
}

#folderAddMenu button:hover {
  background: #f0f8f8;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.sidebar-action-button {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed rgba(126, 215, 214, 0.45);
  border-radius: 8px;
  color: #cdeeec;
  background: rgba(77, 217, 214, 0.08);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sidebar-action-button:hover {
  color: #fff;
  border-color: rgba(126, 215, 214, 0.85);
  background: rgba(77, 217, 214, 0.16);
}

.demo-reset-button {
  display: none;
  width: 100%;
  margin-top: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: rgba(238, 247, 246, 0.72);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.demo-reset-button:hover {
  color: #fff;
  border-color: rgba(126, 215, 214, 0.5);
  background: rgba(255, 255, 255, 0.14);
}

.account-area {
  position: relative;
  margin-top: auto;
}

.account-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #eef7f6;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: rgba(126, 215, 214, 0.5);
  background: rgba(255, 255, 255, 0.14);
}

.account-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #10383a;
  background: #9de1df;
  font-size: 12px;
  font-weight: 900;
}

.account-avatar.large {
  width: 38px;
  height: 38px;
}

.account-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-copy strong,
.account-copy small,
.account-menu-header strong,
.account-menu-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy small {
  color: rgba(238, 247, 246, 0.58);
  font-size: 11px;
}

.account-caret {
  color: rgba(238, 247, 246, 0.58);
  font-size: 13px;
  text-align: center;
}

.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 70;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid rgba(219, 227, 230, 0.9);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 18px 42px rgba(19, 36, 42, 0.24);
}

.account-menu-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.account-menu-header strong,
.account-menu-header small {
  display: block;
}

.account-menu-header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.account-menu button {
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.account-menu button:hover {
  background: #f0f8f8;
}

.account-menu .danger-menu-item {
  color: #8a3d35;
}

.account-menu .danger-menu-item:hover {
  background: #fff4f2;
}

.sidebar-footer {
  display: none;
}

.status-pill {
  display: inline-flex;
  padding: 6px 10px;
  margin-bottom: 8px;
  border-radius: 999px;
  color: #10383a;
  background: #9de1df;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 6px 18px;
  color: #eef7f6;
  background: #13262c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.header-menu-button,
.header-back-button {
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #eef7f6;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  white-space: nowrap;
}

.header-menu-button:hover,
.header-back-button:hover {
  border-color: rgba(126, 215, 214, 0.5);
  background: rgba(255, 255, 255, 0.14);
}

.header-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.header-title strong {
  font-size: 13px;
}

.header-title span {
  overflow: hidden;
  color: rgba(238, 247, 246, 0.68);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-brand {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: opacity 0.15s;
}

.topbar-brand:hover {
  opacity: 0.7;
}

.topbar-brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #1f7477;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.topbar-brand-name {
  font-size: 14px;
  font-weight: 800;
  color: #eef7f6;
}

.header-menu-button {
  display: none;
}

body.sidebar-menu-open::before {
  content: "";
  position: fixed;
  inset: var(--topbar-height) 0 0;
  z-index: 39;
  background: rgba(15, 29, 34, 0.42);
}

body.drawing-mode .topbar {
  min-height: var(--topbar-height);
}

body.drawing-mode .search-box {
  display: none;
}

body.drawing-mode .header-menu-button {
  display: inline-flex;
}

body.drawing-mode .header-back-button {
  display: inline-flex !important;
}

.drawing-toolbox button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.active-tool {
  color: var(--accent-strong);
  border-color: #a7d2d2;
  background: var(--accent-soft);
  font-weight: 700;
}

.search-box {
  display: flex;
  min-width: 320px;
  max-width: 520px;
  flex: 1;
  align-items: stretch;
}

.topbar-search {
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  align-items: center;
}

.topbar-search .topbar-search-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #eef7f6;
  background: rgba(255, 255, 255, 0.08);
}

.topbar-search .topbar-search-button:hover {
  border-color: rgba(126, 215, 214, 0.5);
  background: rgba(255, 255, 255, 0.14);
}

.topbar-search .topbar-search-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* topbarタブ（開いている図面/写真帳/書類の切替） */
.app-tab-bar {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  align-items: center;
}

.app-tab-list {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px 0;
}

.app-tab {
  display: flex;
  flex: 0 0 auto; /* タブは潰さず、あふれたらリスト側を横スクロール */
  min-width: 0;
  max-width: 200px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(238, 247, 246, 0.82);
}

.app-tab:hover {
  background: rgba(255, 255, 255, 0.12);
}

.app-tab.active {
  border-color: rgba(126, 215, 214, 0.55);
  background: rgba(77, 217, 214, 0.16);
  color: #fff;
}

.app-tab-open {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  padding: 5px 2px 5px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.app-tab-icon {
  display: grid;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}

.app-tab-icon.t-drawing {
  background: rgba(96, 165, 250, 0.24);
  color: #9ec9f8;
}

.app-tab-icon.t-book {
  background: rgba(240, 171, 82, 0.24);
  color: #f3b769;
}

.app-tab-icon.t-node {
  background: rgba(126, 215, 214, 0.22);
  color: #7ed7d6;
}

.app-tab-label {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tab-close {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  margin: 0 4px 0 2px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(238, 247, 246, 0.55);
  cursor: pointer;
}

.app-tab-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.app-tab-close svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.app-tab-add {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 247, 246, 0.75);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.app-tab-add:hover {
  border-color: rgba(126, 215, 214, 0.6);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* タブピッカー（フォルダからタブで開く） */
.tab-picker-list {
  display: grid;
  gap: 14px;
  max-height: min(430px, 60vh);
  overflow-y: auto;
}

.tab-picker-section {
  display: grid;
  gap: 4px;
}

.tab-picker-project {
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tab-picker-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.tab-picker-item:hover {
  border-color: #a7d2d2;
  background: var(--accent-soft);
}

.tab-picker-item .app-tab-icon.t-drawing {
  background: #e3effb;
  color: #2563eb;
}

.tab-picker-item .app-tab-icon.t-book {
  background: #fdf0dd;
  color: #b45309;
}

.tab-picker-item .app-tab-icon.t-node {
  background: #e0f4f4;
  color: #1f7477;
}

.tab-picker-label {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.tab-picker-folder {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tab-picker-folder-icon {
  display: grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  place-items: center;
  color: #1f7477;
}

.tab-picker-folder-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-picker-opened {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 700;
}

.tab-picker-empty {
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.search-box input {
  height: 32px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  color: #eef7f6;
  background: rgba(255, 255, 255, 0.08);
}

.search-box input::placeholder {
  color: rgba(238, 247, 246, 0.48);
}

.search-box input:focus {
  border-color: rgba(126, 215, 214, 0.58);
  outline: 2px solid rgba(126, 215, 214, 0.16);
}

.search-box button,
.primary-action {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.primary-action {
  border-radius: 8px;
}

.secondary-action {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #fff;
  font-weight: 800;
}

.bb-toggle-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.bb-toggle-on {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.bb-toggle-off {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.secondary-action.compact {
  padding: 7px 9px;
  font-size: 12px;
}

.secondary-action:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.view {
  display: none;
  padding: 22px;
}

.view.active {
  display: block;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.main-panel,
.detail-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading,
.panel-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

h3 {
  margin: 22px 0 12px;
  font-size: 14px;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.related-strip,
.pin-photos {
  display: grid;
  gap: 12px;
}

/* 写真帳 — 帳票プロパティ一覧 */
.book-field-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.book-field-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--panel-2);
  gap: 6px;
}

.book-field-item.book-field-hidden {
  opacity: 0.45;
}

.book-field-name {
  font-size: 12px;
  font-weight: 600;
  flex: 1;
}

.book-field-name-input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
}

.book-field-name-input:focus {
  border-color: var(--accent);
  outline: none;
}

.book-field-name-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.book-field-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.book-field-item .bb-reorder-btns {
  opacity: 0;
  pointer-events: none;
}

.book-field-item:hover .bb-reorder-btns {
  opacity: 1;
  pointer-events: auto;
}

.book-field-save-row {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.book-field-save-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.related-card,
.pin-photo-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: #fff;
}

.thumb {
  min-height: 110px;
  margin-bottom: 10px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 45%),
    var(--thumb-color, #b8c8cc);
  position: relative;
  overflow: hidden;
}

.thumb::after,
.photo-scene::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px 12px;
  height: 28px;
  border-top: 5px solid rgba(255, 255, 255, 0.6);
  border-bottom: 5px solid rgba(30, 44, 48, 0.16);
}

small {
  color: var(--muted);
}

.property-list {
  display: grid;
  gap: 12px;
}

.property-list div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 3px 0 0;
  line-height: 1.6;
}

/* フォルダ内容ビュー（アイテムをカードで並べる） */
/* 現場ノードは2カラム（カード＋現場情報）、通常フォルダは現場情報を隠して1カラム */
.folder-content-grid.solo {
  grid-template-columns: minmax(0, 1fr);
}

.folder-heading {
  flex-wrap: wrap;
  gap: 12px;
}

.folder-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.folder-toolbar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.folder-view-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.folder-view-toggle button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  font-weight: 900;
}

.folder-view-toggle button:last-child {
  border-right: 0;
}

.folder-view-toggle button:hover,
.folder-view-toggle button.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.folder-view-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
}

.folder-view-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.folder-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.folder-sort select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

/* 表示項目サマリー（左）＋ 選択アクション（右）を1行に */
.folder-view-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.folder-selection-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
}

.folder-selection-count:empty {
  display: none;
}

.folder-selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.folder-selection-actions button {
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.folder-selection-actions button:hover {
  background: var(--accent);
  color: #fff;
}

.folder-selection-actions button.danger {
  border-color: #d8584a;
  color: #c4382a;
}

.folder-selection-actions button.danger:hover {
  background: #d8584a;
  color: #fff;
}

/* 操作できないタイミングはグレーアウト */
.folder-selection-actions button:disabled,
.folder-selection-actions button.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
}

.folder-selection-actions button:disabled:hover,
.folder-selection-actions button.danger:disabled:hover {
  background: #fff;
  color: var(--muted);
}

.folder-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.folder-item-grid.list-mode {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.folder-list-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 92px 80px 116px;
  gap: 12px;
  align-items: center;
  padding: 2px 46px 6px 42px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.folder-card {
  position: relative;
}

.folder-card-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 32px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.folder-item-grid.list-mode .folder-card-open {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 92px 80px 116px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 9px 46px 9px 42px;
  border-radius: 8px;
}

.folder-card-open:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.folder-card-open:active {
  transform: translateY(1px);
}

.folder-card.selected .folder-card-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--accent-soft);
}

.folder-card-check {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  z-index: 2;
  accent-color: var(--accent);
}

.folder-item-grid.list-mode .folder-card-check {
  top: 50%;
  transform: translateY(-50%);
}

.folder-card-menu-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
  z-index: 2;
}

.folder-item-grid.list-mode .folder-card-menu-btn {
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
}

.folder-card:hover .folder-card-menu-btn {
  opacity: 1;
}

.folder-card-menu-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--ink);
}

.folder-move-count {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.folder-move-list {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  margin: 14px 0;
}

.folder-move-target {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
}

.folder-move-target:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.folder-move-target.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 700;
}

#folderMoveConfirmBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.folder-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.folder-card-icon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.folder-item-grid.list-mode .folder-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  font-size: 14px;
}

.folder-card-icon.t-drawing { background: #3b6fd4; }
.folder-card-icon.t-book { background: #c47a1a; }
.folder-card-icon.t-folder { background: #5a6b72; }
.folder-card-icon.t-node { background: var(--accent); }

.folder-card-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* グリッド表示ではラベルは最大2行で省略（カードの高さを揃える） */
.folder-item-grid:not(.list-mode) .folder-card-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.folder-item-grid.list-mode .folder-card-label,
.folder-item-grid.list-mode .folder-card-type,
.folder-item-grid.list-mode .folder-card-count,
.folder-item-grid.list-mode .folder-card-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-item-grid.list-mode .folder-card-label {
  overflow-wrap: normal;
}

.folder-card-type {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfc;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.folder-item-grid.list-mode .folder-card-type {
  width: fit-content;
  justify-content: flex-start;
}

.folder-card-date {
  font-size: 11px;
  color: var(--muted);
}

.folder-card-date:empty {
  display: none;
}

.folder-card-count {
  font-size: 11px;
  color: var(--muted);
}

.folder-card-count:empty {
  display: none;
}

/* グリッド表示ではカード右上に配置し、ホバー時は⋯メニューと入れ替わる */
.folder-item-grid:not(.list-mode) .folder-card-date {
  position: absolute;
  top: 13px;
  right: 13px;
  margin: 0;
  font-size: 10.5px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.12s;
}

.folder-item-grid:not(.list-mode) .folder-card:hover .folder-card-date {
  opacity: 0;
}

.folder-empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  line-height: 1.7;
}

/* 現場情報パネル（プロパティ編集） */
.project-info-form {
  display: grid;
  gap: 14px;
}

.pi-field {
  display: grid;
  gap: 5px;
}

.pi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pi-readonly {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.project-info-form input,
.project-info-form select,
.project-info-form textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.project-info-form textarea {
  resize: vertical;
  line-height: 1.5;
}

.project-info-form input:focus,
.project-info-form select:focus,
.project-info-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.pi-period {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pi-period input {
  flex: 1;
  min-width: 0;
}

.pi-period-sep {
  color: var(--muted);
  flex-shrink: 0;
}

.photo-layout,
.drawing-layout,
.book-layout {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.book-layout .detail-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 22px);
  max-height: calc(100vh - var(--topbar-height) - 44px);
  overflow-y: auto;
  padding: 14px;
}

.book-layout .detail-panel h2 {
  font-size: 18px;
}

.book-layout .detail-panel h3 {
  margin-top: 16px;
}

.book-side-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.book-side-tab {
  flex: 1;
  padding: 9px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.book-side-tab:hover {
  color: var(--ink);
}

.book-side-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.book-tab-panel > .eyebrow:first-child,
.book-tab-panel > h2:first-child {
  margin-top: 0;
}

body.drawing-mode .drawing-layout {
  display: block;
}

body.drawing-mode #view-drawing .main-panel {
  position: relative;
  min-height: calc(100vh - var(--topbar-height));
  margin-top: var(--topbar-height);
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #edf2f3;
}

body.drawing-mode #view-drawing .section-heading {
  position: fixed;
  left: 14px;
  top: calc(var(--topbar-height) + 12px);
  z-index: 8;
  margin: 0;
  pointer-events: none;
}

body.drawing-mode #view-drawing .drawing-title-block {
  display: none;
}

body.drawing-mode #view-drawing .section-heading .drawing-toolbox {
  pointer-events: auto;
}

body.drawing-mode #view-drawing .drawing-tool-status {
  pointer-events: none;
}

.drawing-toolbox {
  display: flex;
  gap: 8px;
}

body.drawing-mode .drawing-toolbox {
  display: grid;
  gap: 9px;
  width: 48px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #13262c;
  box-shadow: 0 14px 32px rgba(19, 36, 42, 0.18);
}

.toolbox-group {
  display: flex;
  gap: 8px;
}

body.drawing-mode .toolbox-group {
  display: grid;
  gap: 7px;
}

body.drawing-mode .toolbox-group + .toolbox-group {
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

body.drawing-mode .drawing-toolbox button {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(238, 247, 246, 0.78);
  background: rgba(255, 255, 255, 0.06);
  font-size: 16px;
  font-weight: 900;
}

body.drawing-mode .drawing-toolbox button:hover,
body.drawing-mode .drawing-toolbox button:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

body.drawing-mode .drawing-toolbox .active-tool {
  color: #fff;
  border-color: rgba(126, 215, 214, 0.54);
  background: #1f7477;
}

body.drawing-mode .drawing-toolbox button:hover::after,
body.drawing-mode .drawing-toolbox button:focus-visible::after {
  position: absolute;
  left: 42px;
  top: 50%;
  z-index: 30;
  min-width: max-content;
  padding: 6px 8px;
  border: 1px solid rgba(219, 227, 230, 0.9);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(19, 36, 42, 0.14);
  content: attr(title);
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}

.drawing-tool-status {
  display: none;
}

body.drawing-mode .drawing-tool-status {
  display: block;
  width: max-content;
  max-width: 210px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(238, 247, 246, 0.72);
  background: #13262c;
  box-shadow: 0 10px 26px rgba(19, 36, 42, 0.16);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

body.drawing-mode .pin-drawer {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  bottom: 0;
  z-index: 10;
  width: min(430px, 34vw);
  overflow-y: auto;
  padding: 14px 16px;
  border-width: 1px 0 0 1px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  transform: translateX(100%);
  transition: transform 180ms ease;
  box-shadow: -12px 0 28px rgba(19, 36, 42, 0.08);
}

body.drawing-mode.panel-open .pin-drawer {
  transform: translateX(0);
}

body.drawing-mode .pin-drawer > .eyebrow,
body.drawing-mode .pin-drawer > h2 {
  display: none;
}

body.drawing-mode .pin-detail-block {
  margin-top: 0;
  padding: 10px 12px;
  border-color: var(--line);
  background: var(--panel-2);
}

body.drawing-mode .pin-detail-block h2 {
  font-size: 16px;
}

body.drawing-mode .pin-form {
  margin-top: 6px;
}

body.drawing-mode .pin-section-heading {
  margin-top: 10px;
}

.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
}

.drawer-close:hover {
  color: #8a3d35;
  border-color: #e2b9b2;
  background: #fff4f2;
}

body.drawing-mode .drawer-close {
  display: none;
}

body.drawing-mode .drawer-close.inline {
  display: grid;
}

.hidden {
  display: none !important;
}

.photo-stage {
  position: relative;
  display: grid;
  min-height: 520px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f3;
}

.floating-back {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(19, 36, 42, 0.1);
  font-weight: 800;
}

.floating-back:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.slide-control {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 42px;
  height: 54px;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: #fff;
  background: rgba(15, 38, 41, 0.56);
  font-size: 30px;
  line-height: 1;
}

.slide-control:hover {
  background: rgba(15, 38, 41, 0.74);
}

.slide-control:disabled {
  cursor: default;
  opacity: 0.28;
}

.slide-prev {
  left: 14px;
}

.slide-next {
  right: 14px;
}

.mock-photo {
  position: relative;
  width: min(820px, 100%);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: #b7c5c6;
  box-shadow: 0 18px 32px rgba(24, 32, 38, 0.16);
}

.photo-scene {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 32%),
    var(--active-photo-color, #b7c5c6);
}

.photo-scene::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 20%;
  bottom: 28%;
  border: 10px solid rgba(44, 65, 70, 0.24);
  border-left-width: 18px;
  border-right-width: 18px;
  transform: skewY(-3deg);
}

/* ─── 工事黒板 共通変数 ─── */
:root {
  --bb-bg: #1a3828;
  --bb-bg2: #14301f;
  --bb-border: rgba(255, 255, 255, 0.55);
  --bb-text: #f0efe8;
  --bb-label-bg: #122a1c;
  --bb-accent: #a8d8b0;
}

/* ─── 黒板オーバーレイ（写真ビュー） ─── */
.blackboard-overlay {
  position: absolute;
  bottom: 14px;
  width: 30%;
  border: 1px solid var(--bb-border);
  border-radius: 3px;
  color: var(--bb-text);
  background: var(--bb-bg);
  font-size: 10px;
  line-height: 1.4;
  font-family: "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  overflow: hidden;
}

.blackboard-overlay.pos-bottom-right { right: 14px; left: auto; }
.blackboard-overlay.pos-bottom-left  { left: 14px;  right: auto; }

.blackboard-overlay.template-simple {
  width: min(260px, calc(100% - 28px));
}

.blackboard-overlay.hidden {
  display: none;
}


/* グリッドテーブル */
.blackboard-overlay .bb-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: inherit;
}

.blackboard-overlay .bb-th {
  width: 5.5em;
  padding: 3px 6px;
  background: var(--bb-label-bg);
  border: 1px solid var(--bb-border);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--bb-accent);
}

.blackboard-overlay .bb-td {
  padding: 3px 6px;
  border: 1px solid var(--bb-border);
  vertical-align: middle;
  word-break: break-all;
}

/* 工事内容セクション — 黒板の主役エリア */
.blackboard-overlay .bb-content {
  border-top: 1px solid var(--bb-border);
  border-bottom: 1px solid var(--bb-border);
}

.blackboard-overlay .bb-content-hd {
  padding: 3px 8px;
  text-align: center;
  font-size: 9px;
  letter-spacing: 0.15em;
  background: var(--bb-label-bg);
  border-bottom: 1px solid var(--bb-border);
  color: var(--bb-accent);
}

.blackboard-overlay .bb-content-bd {
  padding: 6px 8px;
  min-height: 52px; /* 3〜4行分の高さ */
  word-break: break-all;
  font-size: 10px;
  line-height: 1.65;
}


/* プロパティ連動マーク */
.blackboard-overlay .bb-link-mark {
  margin-left: 3px;
  font-size: 8px;
  color: var(--bb-accent);
  opacity: 0.8;
  vertical-align: middle;
}

/* ─── 黒板ホバー編集ボタン ─── */
.bb-edit-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 3px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}

.blackboard-overlay:hover .bb-edit-btn {
  opacity: 1;
}

.bb-edit-btn:hover {
  background: rgba(0,0,0,0.7);
}

/* ─── サイズ選択 ─── */
.bb-size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.bb-size-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.bb-size-buttons {
  display: flex;
  gap: 4px;
}

.bb-size-btn,
.bb-pos-btn {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.bb-size-btn:hover,
.bb-pos-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.bb-size-btn.active,
.bb-pos-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.bb-size-highlight {
  animation: bb-size-flash 1.2s ease;
}

@keyframes bb-size-flash {
  0%   { background: var(--accent-soft); }
  100% { background: transparent; }
}

.blackboard-status {
  display: inline-flex;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #7a4f1d;
  background: #fff4d7;
  font-size: 11px;
  font-weight: 800;
}

.blackboard-status.complete {
  color: #176b6f;
  background: #e5f6f6;
}

.related-strip {
  display: grid;
  grid-auto-columns: 148px;
  grid-auto-flow: column;
  grid-template-columns: none;
  gap: 10px;
  margin-top: 10px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  scroll-padding: 12px;
}

.filmstrip-meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.related-card {
  position: relative;
}

.related-card .thumb {
  min-height: 72px;
}

.related-card.active {
  border-color: var(--accent);
  background: #f2fbfb;
  box-shadow: 0 0 0 3px rgba(23, 107, 111, 0.16);
  transform: translateY(-2px);
}

.related-card.active::after {
  content: "表示中";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.related-card.active .thumb {
  min-height: 82px;
}

.switch {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch-track {
  display: inline-flex;
  align-items: center;
  position: relative;
  width: 48px;
  height: 26px;
  padding: 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(23, 107, 111, 0.16);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.switch-thumb {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--accent-strong);
  box-shadow: 0 2px 7px rgba(15, 85, 88, 0.18);
  transform: translateX(0);
  transition: transform 190ms cubic-bezier(0.2, 0.8, 0.2, 1), background 180ms ease;
}

.switch-input:checked + .switch-track {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 85, 88, 0.2);
}

.switch-input:checked + .switch-track .switch-thumb {
  background: #ffffff;
  transform: translateX(22px);
}

.switch-button[aria-checked="true"] .switch-track {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 85, 88, 0.2);
}

.switch-button[aria-checked="true"] .switch-thumb {
  background: #ffffff;
  transform: translateX(22px);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid rgba(23, 107, 111, 0.35);
  outline-offset: 3px;
}

.switch-label::before {
  content: "黒板";
}

.switch-input:checked ~ .switch-label::before {
  content: "黒板";
}

.switch-button[aria-checked="true"] .switch-label::before {
  content: "黒板";
}

.switch-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.blackboard-visibility-switch {
  min-height: 32px;
}

.book-blackboard-switch {
  min-height: 32px;
  padding: 0;
}

.search-blackboard-switch {
  justify-self: end;
  min-height: 32px;
  padding: 0;
}

.blackboard-form {
  display: grid;
  gap: 10px;
}

.blackboard-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.blackboard-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* フィールド行：ラベル + 表示/非表示ボタンを横並び */
.bb-field-row {
  display: grid;
  gap: 4px;
}

.bb-field-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bb-field-label {
  flex: 1;
}

.bb-field-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* プロパティ追加行 */
.bb-add-row {
  margin-bottom: 8px;
}

.bb-add-property-btn {
  padding: 4px 12px;
  border: 1px dashed var(--accent);
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}

.bb-add-property-btn:hover {
  background: var(--accent-soft);
}

.bb-add-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bb-add-inline input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

.bb-add-inline button {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.bb-add-inline button:first-of-type {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* カスタムフィールド削除ボタン */
.bb-delete-field-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.bb-delete-field-btn:hover {
  border-color: #e2b9b2;
  color: #8a3d35;
  background: #fff4f2;
}

/* ▲▼ 並び替えボタン — ホバー時のみ表示 */
.bb-reorder-btns {
  display: flex;
  gap: 2px;
  margin-right: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.bb-field-row:hover .bb-reorder-btns {
  opacity: 1;
  pointer-events: auto;
}

.bb-reorder-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.bb-reorder-btn:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--ink);
}

.bb-reorder-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* 表示/非表示トグルボタン — 幅固定で揃える */
.field-vis-btn {
  min-width: 46px;
  padding: 1px 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  line-height: 1.6;
}

.field-vis-btn.field-vis-on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.field-vis-btn.field-vis-off {
  border-color: var(--line);
  color: var(--muted);
  background: #f5f7f8;
}

/* 自動引用フィールド（グレーアウト） */
.field-auto {
  background: var(--panel-2) !important;
  color: var(--muted) !important;
  cursor: default;
}

.blackboard-form input,
.blackboard-form select,
.blackboard-form textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.blackboard-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.form-switch {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tag {
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.relation-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.relation-panel-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.relation-panel-heading h3 {
  margin: 0;
}

.photo-relation-add {
  display: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.photo-relation-add.is-open {
  display: grid;
}

.photo-relation-add.hidden {
  display: none !important;
}

.relation-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.relation-picker select {
  width: 100%;
  min-width: 0;
}

.relation-pin-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.search-action-toolbar > button {
  min-height: 32px;
  justify-self: end;
}

.photo-relation-add select {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.photo-relation-add button:disabled,
.photo-relation-add select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.relation-drawing-picker {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, calc(100vw - 42px));
  max-height: min(680px, calc(100vh - 42px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 28, 0.18);
}

.relation-drawing-canvas {
  position: relative;
  min-height: 430px;
  margin: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(23, 107, 111, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 107, 111, 0.08) 1px, transparent 1px),
    #f9fbfb;
  background-size: 32px 32px;
}

.relation-drawing-canvas .room {
  position: absolute;
  padding: 8px 10px;
  border: 1px solid rgba(23, 107, 111, 0.18);
  border-radius: 6px;
  color: rgba(24, 32, 38, 0.62);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.relation-drawing-canvas .room-a {
  left: 22%;
  top: 26%;
}

.relation-drawing-canvas .room-b {
  left: 48%;
  top: 20%;
}

.relation-drawing-canvas .room-c {
  right: 14%;
  bottom: 22%;
}

.relation-picker-pin {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(19, 36, 42, 0.22);
  font-size: 12px;
  font-weight: 900;
}

.relation-picker-pin:hover,
.relation-picker-pin.selected {
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px rgba(23, 107, 111, 0.18), 0 8px 18px rgba(19, 36, 42, 0.22);
}

.relation-picker-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.photo-property-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.property-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.property-field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.relation-list {
  display: grid;
  gap: 8px;
}

.relation-summary-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--panel-2);
}

.relation-summary-row span {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 900;
}

.relation-summary-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.relation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.relation-card-open {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.relation-card-open:hover {
  background: #f2fbfb;
}

.relation-card-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
}

.relation-card-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.relation-card-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.relation-card-main strong,
.relation-card-main small,
.relation-card-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-card-main em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.relation-card-main strong {
  font-size: 13px;
}

.relation-card-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.relation-card-remove {
  width: 34px;
  border: 0;
  border-left: 1px solid var(--line);
  color: #8a3d35;
  background: #fff;
  font-size: 16px;
  font-weight: 900;
}

.relation-card-remove:hover {
  background: #fff4f2;
}

.relation-empty-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px dashed #b8c8cc;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
}

.relation-empty-card strong {
  color: var(--ink);
}

.relation-empty-card small {
  line-height: 1.5;
}

.pin-tag-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.relation-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pin-tag-row {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
  max-width: 100%;
  justify-self: start;
  border: 1px solid #a7d2d2;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent-soft);
}

.pin-tag-row.readonly {
  grid-template-columns: minmax(0, 1fr);
}

.pin-tag {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 6px 10px;
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 800;
}

.pin-tag.external {
  cursor: default;
}

.pin-tag-label {
  display: inline-grid;
  min-width: 42px;
  place-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
}

.pin-tag-title {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.pin-tag-title {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.pin-tag-title:hover {
  color: var(--accent);
}

.pin-tag-remove {
  display: grid;
  width: 30px;
  place-items: center;
  border: 0;
  border-left: 1px solid #a7d2d2;
  color: #8a3d35;
  background: rgba(255, 255, 255, 0.58);
  font-weight: 900;
}

.pin-tag-remove:hover {
  background: #fff4f2;
}

.pin-tag-meta {
  display: block;
  color: var(--muted);
}

.pin-tag-empty,
.pin-undo-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 10px;
  border: 1px dashed #b8c8cc;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
}

.pin-tag-empty span,
.pin-undo-inline span {
  color: var(--ink);
  font-weight: 800;
}

.undo-pin-button,
.pin-undo-inline button {
  padding: 6px 8px;
  border: 1px solid #a7d2d2;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.undo-pin-button:hover,
.pin-undo-inline button:hover {
  background: #eefafa;
}

.relation-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
}

.relation-button:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.relation-type {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.relation-button strong {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawing-canvas {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.drawing-pdf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 0;
}

.drawing-hint {
  position: absolute;
  left: 50%;
  top: 78px;
  z-index: 4;
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(167, 210, 210, 0.9);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(19, 36, 42, 0.1);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 8;
  padding: 10px 14px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 38, 41, 0.88);
  box-shadow: 0 10px 24px rgba(19, 36, 42, 0.18);
  font-size: 12px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 36, 42, 0.42);
  backdrop-filter: blur(3px);
}

.photo-picker-modal {
  width: min(760px, 96vw);
  max-height: min(720px, 88vh);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(19, 36, 42, 0.28);
}

.book-photo-command {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(1120px, 96vw);
  max-height: min(820px, 90vh);
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(19, 36, 42, 0.28);
}

.book-create-modal {
  display: grid;
  gap: 16px;
  width: min(460px, 96vw);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 33, 38, 0.24);
}

.single-relation-modal {
  display: grid;
  gap: 16px;
  width: min(520px, 96vw);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 33, 38, 0.24);
}

.single-relation-picker {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.book-create-form {
  display: grid;
  gap: 12px;
}

.book-create-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-create-form input,
.book-create-form select {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.book-create-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.book-create-fieldset legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-actions {
  position: static;
  margin: 0;
  padding: 8px 0 0;
  border-top: 0;
  background: transparent;
  backdrop-filter: none;
}

.book-command-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.book-command-search input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfc;
  font-size: 14px;
}

.book-command-search input:focus {
  border-color: #93caca;
  outline: 2px solid rgba(23, 107, 111, 0.13);
}

.book-filter-bar,
.search-filter-panel,
.filter-group {
  display: grid;
  gap: 10px;
}

.book-filter-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.book-filter-bar label,
.search-filter-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-filter-bar select,
.book-filter-bar input,
.search-filter-panel select,
.search-filter-panel input[type="date"] {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.search-filter-panel {
  margin-top: 14px;
}

.filter-group {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.filter-group strong {
  font-size: 13px;
}

.filter-group label:has(input[type="checkbox"]) {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
}

.capture-photo-command {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #1f7477;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.book-photo-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.book-photo-result {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  min-height: 154px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
}

.book-photo-result:hover:not(:disabled) {
  border-color: #a7d2d2;
  background: #f2fbfb;
}

.book-photo-result .thumb {
  height: 118px;
  min-height: 118px;
  margin: 0;
  border-radius: 6px;
}

.book-photo-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

.book-photo-thumb span {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(19, 38, 44, 0.72);
  font-size: 11px;
  font-weight: 800;
}

.book-photo-result em {
  width: max-content;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.book-photo-result.added {
  opacity: 0.55;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.drawer-close.inline {
  position: static;
}

.modal-search {
  max-width: none;
}

.picker-status {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.picker-status-chip {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
}

.picker-status-chip.unset {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.picker-status-chip.move {
  color: #7a5330;
  background: #fff3df;
}

.photo-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.photo-picker-card {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
}

.photo-picker-card:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.photo-picker-card strong,
.photo-picker-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-card-status {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.picker-card-status.move {
  color: #7a5330;
  background: #fff3df;
}

.picker-card-status.unset {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

body.drawing-mode .drawing-hint {
  left: calc(50% + 24px);
}

body.drawing-mode .drawing-canvas {
  min-height: calc(100vh - var(--topbar-height));
  margin-right: 0;
  border: 0;
  border-radius: 0;
}

body.drawing-mode.panel-open .drawing-canvas {
  margin-right: min(430px, 34vw);
}

.drawing-canvas.placing-pin {
  cursor: crosshair;
  box-shadow: inset 0 0 0 3px rgba(23, 107, 111, 0.18);
}

body.drawing-mode .drawing-canvas {
  touch-action: none;
}

.drawing-canvas.placing-pin::after {
  content: "クリックしてピンを配置";
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
  padding: 8px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 85, 88, 0.9);
  font-size: 12px;
  font-weight: 800;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.8;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotation-stroke,
.annotation-shape {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.annotation-stroke.pen {
  stroke: #d85f45;
  stroke-width: 0.45;
}

.annotation-stroke.marker {
  stroke: rgba(216, 148, 47, 0.72);
  stroke-width: 1.25;
}

.annotation-shape.shape {
  stroke: #176b6f;
  stroke-width: 0.45;
  fill: rgba(23, 107, 111, 0.08);
}

.drawing-canvas.tool-pen,
.drawing-canvas.tool-marker,
.drawing-canvas.tool-shape {
  cursor: crosshair;
}

.drawing-canvas.tool-eraser {
  cursor: not-allowed;
}

.room {
  position: absolute;
  display: grid;
  place-items: center;
  border: 2px solid #8aa0a6;
  color: #66747b;
  font-weight: 800;
}

.room-a {
  left: 13%;
  top: 18%;
  width: 36%;
  height: 36%;
}

.room-b {
  left: 49%;
  top: 18%;
  width: 35%;
  height: 36%;
}

.room-c {
  left: 49%;
  top: 54%;
  width: 35%;
  height: 28%;
}

.pin {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #8f9da1;
  box-shadow: 0 8px 18px rgba(80, 48, 12, 0.25);
  font-size: 14px;
  font-weight: 800;
  touch-action: none;
}

/* ステータスによるピン色 */
.pin.status-pin-未撮影  { background: #8f9da1; }
.pin.status-pin-撮影済み { background: #0891b2; }
.pin.status-pin-完了    { background: #2d7a3a; }

/* 選択中は枠線で示す */
.pin.active {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(23, 107, 111, 0.35), 0 8px 18px rgba(80, 48, 12, 0.25);
}

.pin-number {
  line-height: 1;
}

.pin-photo-count {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #34494e;
  box-shadow: 0 4px 10px rgba(30, 44, 48, 0.22);
  font-size: 10px;
  font-weight: 900;
}

.pin.status-pin-未撮影 .pin-photo-count  { background: #6a7d82; }
.pin.status-pin-撮影済み .pin-photo-count { background: #0369a1; }
.pin.status-pin-完了 .pin-photo-count    { background: #1e5428; }

.pin-selected-chip,
.pin-star-chip {
  position: absolute;
  top: -9px;
  right: calc(100% - 9px);
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.pin-selected-chip {
  background: #182026;
  color: #fff;
}

.pin-star-chip {
  background: #f5a623;
  color: #fff;
}

.pin-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
}

.pin-star-button {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  background: #fff;
  transition: opacity 0.15s;
  margin-top: 4px;
  line-height: 1;
}

.pin-star-button:hover {
  opacity: 0.75;
}

.pin-star-button[data-starred="true"] {
  color: #f5a623;
  border-color: #f5c97a;
  background: #fffbf0;
}

.pin-detail-block {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.pin-number-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.pin-status-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* 表示番号inputをbadgeと同じ見た目に合わせる */
.pin-form .pin-number-row input[type="number"] {
  width: 72px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: #fff;
  text-align: center;
}

.pin-status-badge {
  position: relative;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  text-align: center;
}

.pin-status-badge:hover {
  opacity: 0.75;
}

.pin-status-badge[data-status="未撮影"] {
  color: #69747c;
  border-color: #b8c8cc;
  background: #f2f5f6;
}

.pin-status-badge[data-status="撮影済み"] {
  color: var(--accent-strong);
  border-color: #a7d2d2;
  background: var(--accent-soft);
}

.pin-status-badge[data-status="完了"] {
  color: #2d6a3a;
  border-color: #8ecf9a;
  background: #eafaf0;
}

.pin-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pin-stats span {
  padding: 4px 7px;
  border: 1px solid #d4e1e4;
  border-radius: 999px;
  color: #41595d;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.pin-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pin-section-heading.archive-heading {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pin-section-heading h3 {
  flex: 1 1 auto;
  margin: 0;
}

.pin-section-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pin-place-hint {
  padding: 9px 10px;
  margin: 10px 0;
  border: 1px solid #a7d2d2;
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.pin-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.pin-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pin-form input,
.pin-form textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.pin-photos {
  display: grid;
  gap: 10px;
  min-height: 120px;
  padding: 8px;
  border: 1px dashed transparent;
  border-radius: 10px;
}

body.drawing-mode .pin-photos {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pin-archive-photos {
  background: #f7fbfb;
}

.pin-archive-photos.archive-drop-over,
.pin-photos.restore-drop-over {
  border-color: #93caca;
  background: #eefafa;
  box-shadow: inset 0 0 0 2px rgba(23, 107, 111, 0.12);
}

.pin-photo-card {
  position: relative;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: #fff;
  cursor: grab;
}

.pin-photo-card.archived {
  border-color: #a7d2d2;
  background: #f8fcfc;
}

.pin-photo-card:hover {
  border-color: #93caca;
  background: #f8fcfc;
}

.pin-photo-card:hover .pin-photo-handle {
  color: var(--accent-strong);
}

.pin-photo-handle {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  display: grid;
  width: 18px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  color: #9aa9ad;
  background: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 900;
  writing-mode: vertical-rl;
}

.pin-photo-card.dragging {
  opacity: 0.45;
}

.pin-photo-card.drag-before,
.pin-photo-card.drag-after {
  position: relative;
}

.pin-photo-card.drag-before::before,
.pin-photo-card.drag-after::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 111, 0.14);
}

.pin-photo-card.drag-before::before {
  left: -6px;
}

.pin-photo-card.drag-after::before {
  right: -6px;
}

body.drawing-mode .pin-photo-card {
  min-width: 0;
}

.pin-photo-open {
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

body.drawing-mode .pin-photo-open {
  grid-template-columns: minmax(0, 1fr);
}

body.drawing-mode .pin-photo-open .thumb {
  min-height: 72px;
}

.pin-photo-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: flex;
  gap: 4px;
}

body.drawing-mode .pin-photo-actions {
  display: flex;
}

.pin-photo-open .thumb {
  min-height: 44px;
  margin: 0;
}

.pin-photo-open strong,
.pin-photo-open small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-photo-open strong {
  font-size: 12px;
}

.pin-photo-open small {
  font-size: 10px;
}

.pin-photo-badge {
  display: inline-block;
  width: max-content;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.pin-icon-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
}

.pin-icon-button.primary {
  border-color: #a7d2d2;
  background: var(--accent-soft);
}

.pin-icon-button:hover {
  border-color: #93caca;
  background: #eefafa;
}

.pin-icon-button.danger {
  color: #8a3d35;
}

.pin-icon-button.danger:hover {
  border-color: #e2b9b2;
  background: #fff4f2;
}

.empty-inline {
  padding: 10px;
  border: 1px dashed #b8c8cc;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
  font-size: 12px;
}

.link-status {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.book-pages {
  display: grid;
  gap: 18px;
}

.book-page {
  padding: 28px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 12px #f2f4f5;
}

.book-page-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.book-page-header strong {
  font-size: 15px;
}

.book-page-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-left: auto;
}

.add-blank-slot-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px dashed var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.add-blank-slot-btn:hover {
  background: var(--accent-soft);
}

.capture-photo-add-btn,
.capture-photo-command {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  border-color: #1f7477;
  color: #0f5558;
  background: #eefafa;
}

.capture-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 15px;
  height: 14px;
}

.capture-icon svg {
  display: block;
  width: 15px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.capture-photo-add-btn:hover,
.capture-photo-command:hover {
  background: #d9eeee;
}

.blank-slot .thumb,
.blank-slot-thumb {
  min-height: 110px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 2px dashed var(--line);
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.book-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.book-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.book-layout-select {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-layout-select select {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.book-layout-select small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.book-side-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: -14px -14px 18px;
  padding: 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: rgba(238, 243, 245, 0.96);
  backdrop-filter: blur(10px);
}

.book-side-tabs button {
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.book-side-tabs button.active {
  color: var(--accent-strong);
  border-color: #a7d2d2;
  background: #fff;
}

#view-book .detail-panel > .eyebrow[data-book-tab-panel],
#view-book .detail-panel > h2[data-book-tab-panel] {
  margin-bottom: 0;
}

#view-book .detail-panel > .eyebrow[data-book-tab-panel] {
  margin-top: 0;
  margin-bottom: 4px;
}

#view-book .detail-panel > h2[data-book-tab-panel] {
  margin-bottom: 8px;
}

#view-book .detail-panel > p[data-book-tab-panel] {
  margin-bottom: 14px;
  font-size: 12px;
}

#view-book [data-book-tab-panel].hidden {
  display: none !important;
}

.book-output-form {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.book-output-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-output-form label small {
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.book-output-form .book-output-check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}

.book-output-form input,
.book-output-form select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.book-output-form .book-output-check input {
  width: auto;
  padding: 0;
}

.book-output-form input:focus,
.book-output-form select:focus {
  border-color: #93caca;
  outline: 2px solid rgba(23, 107, 111, 0.13);
}

.book-submit-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

#view-book .book-submit-panel[data-book-tab-panel] {
  margin-top: 2px;
}

#view-book #bookVisibleFields[data-book-tab-panel] {
  margin-top: 8px;
}

.book-submit-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.book-submit-heading h2 {
  font-size: 18px;
}

.book-submit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.book-edit-lock {
  padding: 9px 10px;
  border: 1px solid #f0d5ae;
  border-radius: 8px;
  color: #7a5330;
  background: #fff8ed;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.book-resubmit-reason {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-resubmit-reason textarea {
  width: 100%;
  padding: 8px 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.book-resubmit-reason textarea:focus {
  border-color: #93caca;
  outline: 2px solid rgba(23, 107, 111, 0.13);
}

.book-revision-status {
  display: grid;
  gap: 10px;
}

.book-revision-list {
  display: grid;
  gap: 10px;
}

.book-revision-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.book-revision-item.pending {
  border-left: 3px solid #d7b85a;
}

.book-revision-item.approved {
  border-left: 3px solid #5aa66a;
}

.book-revision-item.rejected {
  border-left: 3px solid #c36b60;
}

.book-revision-item strong,
.book-revision-item span,
.book-revision-item p {
  display: block;
}

.book-revision-item strong {
  color: var(--accent-strong);
}

.book-revision-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.book-revision-head > strong {
  margin-right: auto;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.book-revision-head .revision-type,
.book-revision-head .revision-review,
.book-revision-head em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.book-revision-head .revision-type {
  margin-right: 0;
}

.book-revision-head > span:not(.revision-type):not(.revision-review) {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #f4f6f6;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.revision-type.initial {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.revision-type.resubmission {
  color: #7a5330;
  background: #fff3df;
}

.revision-review.pending {
  color: #6b5a2a;
  background: #fff6d8;
}

.revision-review.approved {
  color: #2d6a3a;
  background: #eafaf0;
}

.revision-review.rejected {
  color: #8a3d35;
  background: #fff4f2;
}

.book-revision-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.book-revision-actions button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.book-revision-actions button:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.book-revision-head em.clean {
  color: #2d6a3a;
  background: #eafaf0;
}

.book-revision-head em.changed {
  color: #7a5330;
  background: #fff3df;
}

.book-revision-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.book-revision-item p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.book-revision-item .book-revision-note {
  color: var(--muted);
}

.book-revision-item .book-revision-review-note {
  color: #7a5330;
}

.book-revision-diff {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.book-revision-diff summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.book-revision-diff dl {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
}

.book-revision-diff dl div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #eef1f1;
  border-radius: 6px;
  background: #fbfcfc;
}

.book-revision-diff dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.book-revision-diff dd {
  display: grid;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.book-revision-diff dd span,
.book-revision-diff dd strong {
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.45;
}

.book-revision-diff dd span {
  color: var(--muted);
  text-decoration: line-through;
}

.book-revision-diff dd strong {
  color: var(--ink);
}

.book-revision-change-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.book-revision-change-list li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #eef1f1;
  border-radius: 6px;
  background: #fbfcfc;
  font-size: 12px;
}

.book-revision-change-list span {
  color: var(--muted);
}

.book-revision-change-list strong {
  color: var(--ink);
  font-weight: 700;
}

.output-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.output-summary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.output-summary strong,
.output-summary span {
  display: block;
}

.output-summary strong {
  font-size: 18px;
}

.output-summary span {
  color: var(--muted);
  font-size: 11px;
}

.book-item {
  align-self: start;
  padding: 12px;
  border: 1px solid #cedadd;
  border-radius: 6px;
  background: #fff;
  cursor: grab;
}

.page-break-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed #a7d2d2;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #f2fbfb;
  cursor: grab;
}

.page-break-item span {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}

.book-empty-slot {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 12px;
  border: 1px dashed #c7d3d6;
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafb;
  text-align: center;
}

.book-empty-slot strong,
.book-empty-slot span {
  display: block;
}

.book-empty-slot strong {
  margin-bottom: 4px;
  color: #87949a;
}

.print-preview-screen {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.print-preview-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.print-preview-meta div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.print-preview-meta strong,
.print-preview-meta span {
  display: block;
}

.print-preview-meta strong {
  font-size: 14px;
}

.print-preview-meta span {
  color: var(--muted);
  font-size: 11px;
}

.print-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.print-template-control {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.print-template-control select {
  min-height: 32px;
  padding: 6px 30px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.print-preview-toolbar span {
  min-width: 54px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.print-preview-canvas {
  max-height: calc(100vh - 210px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe5e7;
}

.print-preview-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 212px);
  min-height: 620px;
  border: 0;
  border-radius: 8px;
}

.progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 38, 0.32);
}

.progress-overlay.hidden {
  display: none;
}

.progress-dialog {
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 33, 38, 0.24);
}

.account-settings-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  width: min(980px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  min-height: min(640px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 28, 0.18);
}

.settings-heading {
  margin-bottom: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #ededed;
  background: #fff;
}

.settings-heading h2 {
  font-size: 20px;
  font-weight: 700;
}

.settings-heading .eyebrow {
  margin-bottom: 4px;
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: 0;
}

.settings-summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 22px;
  border-bottom: 1px solid #ededed;
  background: #fff;
}

.settings-summary strong,
.settings-summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-summary small {
  margin-top: 2px;
  color: #7a7a7a;
  font-size: 12px;
  font-weight: 500;
}

.settings-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: 0;
}

.settings-tabs {
  display: grid;
  align-content: start;
  gap: 2px;
  max-height: 100%;
  overflow: auto;
  padding: 12px 10px;
  border-right: 1px solid #ededed;
  background: #f7f7f5;
  scrollbar-width: thin;
}

.settings-tabs button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #5f5f5f;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
}

.settings-tabs button:hover {
  color: #262626;
  background: #ececea;
}

.settings-tabs button.active {
  color: #1f1f1f;
  border-color: transparent;
  background: #e9e9e6;
  box-shadow: none;
}

.settings-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: #6f6f6f;
  font-size: 12px;
  font-weight: 600;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #dedede;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.settings-form input:focus,
.settings-form select:focus,
.settings-form textarea:focus {
  border-color: #b8b8b8;
  background: #fff;
  outline: 2px solid rgba(35, 35, 35, 0.08);
}

.settings-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.settings-form .settings-check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #37352f;
  font-size: 13px;
  font-weight: 500;
}

.settings-form .settings-check input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  z-index: 2;
  margin: 0;
  padding: 12px 22px;
  border-top: 1px solid #ededed;
  background: rgba(255, 255, 255, 0.98);
}

.settings-actions .secondary-action,
.settings-actions .primary-action {
  min-width: 88px;
  justify-content: center;
}

.settings-panel {
  display: none;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 24px 32px 30px;
  scrollbar-width: thin;
}

.settings-panel.active {
  display: grid;
  align-content: start;
}

.settings-section-heading {
  display: grid;
  gap: 4px;
  padding-top: 0;
}

.settings-panel > .settings-section-heading:not(:first-child) {
  margin-top: 6px;
  padding-top: 20px;
  border-top: 1px solid #ededed;
}

.settings-section-heading h3 {
  margin: 0;
  color: #37352f;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.settings-section-heading p {
  margin: 0;
  color: #787774;
  font-size: 13px;
  line-height: 1.6;
}

.settings-subsection {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.settings-subsection h4 {
  margin: 0;
  color: #37352f;
  font-size: 13px;
  font-weight: 700;
}

.settings-panel > label,
.settings-panel > .settings-check {
  max-width: 640px;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.settings-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
}

.settings-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid #ededed;
  border-radius: 0;
  background: transparent;
}

.settings-card strong,
.settings-card span {
  min-width: 0;
}

.settings-card span {
  grid-column: 1 / -1;
  color: #787774;
  font-size: 13px;
  line-height: 1.5;
}

.settings-card .secondary-action {
  grid-column: 2;
  grid-row: 1;
}

.settings-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}

.settings-check-grid .settings-check {
  min-height: 32px;
  padding: 5px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.settings-panel > .settings-check {
  min-height: 34px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.excel-template-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #ededed;
  border-bottom: 1px solid #ededed;
  border-radius: 0;
  background: transparent;
}

.excel-template-import strong,
.excel-template-import span {
  display: block;
}

.excel-template-import span,
.excel-template-status {
  color: #787774;
  font-size: 13px;
  line-height: 1.5;
}

.excel-template-status {
  grid-column: 1 / -1;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 600;
}

.output-format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.output-format-row .settings-check {
  min-height: 32px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.report-designer {
  display: grid;
  gap: 12px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid #ededed;
  border-radius: 0;
  background: transparent;
}

.report-designer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.report-designer-toolbar button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid #dedede;
  border-radius: 6px;
  color: #37352f;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
}

.report-grid-size-control {
  display: flex !important;
  flex-direction: row;
  gap: 7px !important;
  align-items: center;
  min-height: 30px;
  padding: 0 2px 0 0;
  color: #787774;
  font-size: 12px;
  font-weight: 600;
}

.report-grid-size-control select {
  min-height: 30px;
  width: auto;
  padding: 5px 28px 5px 8px;
  border: 1px solid #dedede;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.report-designer-toolbar button:hover {
  border-color: #c8c8c8;
  background: #f7f7f5;
}

.report-designer-body {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(210px, 1fr);
  gap: 12px;
  align-items: start;
}

.report-grid-page {
  position: relative;
  width: 100%;
  aspect-ratio: 210 / 297;
  border: 1px solid #d7d7d4;
  border-radius: 6px;
  background:
    linear-gradient(to right, rgba(23, 107, 111, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 107, 111, 0.12) 1px, transparent 1px),
    #fff;
  background-size: calc(100% / var(--report-grid-columns, 12)) calc(100% / var(--report-grid-rows, 18));
  box-shadow: none;
  overflow: hidden;
}

.report-grid-block {
  position: absolute;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 7px;
  border: 1px solid #78979a;
  border-radius: 5px;
  color: var(--ink);
  background: rgba(217, 238, 238, 0.92);
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
}

.report-grid-block:hover,
.report-grid-block.active {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(23, 107, 111, 0.16);
}

.report-grid-block.photo {
  background: rgba(169, 183, 164, 0.88);
}

.report-grid-block.fields {
  background: rgba(238, 243, 245, 0.94);
}

.report-grid-block.approval {
  background: rgba(255, 247, 230, 0.94);
}

.report-grid-block small {
  color: rgba(24, 32, 38, 0.68);
  font-size: 9px;
  font-weight: 800;
}

.report-block-inspector {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid #ededed;
  border-radius: 0;
  background: transparent;
}

.report-block-inspector strong {
  font-size: 13px;
}

.report-block-inspector span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.report-inspector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.report-inspector-grid label {
  gap: 4px;
}

.report-inspector-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.report-inspector-actions button {
  min-height: 30px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.report-inspector-actions button:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.report-inspector-actions .danger {
  color: #8a3d35;
}

.report-inspector-actions .danger:hover {
  border-color: #e2b9b2;
  background: #fff4f2;
}

.report-template-preview {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid #ededed;
  border-radius: 0;
  background: transparent;
}

.report-preview-page {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #d7d7d4;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}

.report-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding-bottom: 7px;
  border-bottom: 1px solid #ededed;
}

.report-preview-header strong {
  font-size: 13px;
}

.report-preview-header span,
.report-preview-note span {
  color: #787774;
  font-size: 11px;
  font-weight: 600;
}

.report-preview-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 8px;
  min-height: 110px;
}

.report-preview-photo {
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 45%),
    #a9b7a4;
}

.report-preview-fields {
  display: grid;
  align-content: stretch;
  border: 1px solid #dedede;
  border-radius: 5px;
  overflow: hidden;
}

.report-preview-fields span {
  display: flex;
  align-items: center;
  padding: 5px 7px;
  border-bottom: 1px solid #ededed;
  color: #787774;
  font-size: 10px;
  font-weight: 600;
}

.report-preview-fields span:last-child {
  border-bottom: 0;
}

.report-preview-stamps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-self: end;
  width: 150px;
  border: 1px solid #dedede;
  border-radius: 5px;
  overflow: hidden;
}

.report-preview-stamps span {
  display: grid;
  min-height: 32px;
  place-items: center;
  border-right: 1px solid #ededed;
  color: #787774;
  font-size: 10px;
  font-weight: 600;
}

.report-preview-stamps span:last-child {
  border-right: 0;
}

.report-preview-note {
  display: grid;
  gap: 4px;
  color: #37352f;
}

.settings-actions .primary-action {
  border-radius: 6px;
}

.settings-actions .secondary-action {
  border-radius: 6px;
  color: #37352f;
  border-color: #dedede;
}

.deleted-items-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(760px, calc(100vw - 48px));
  max-height: min(680px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 28, 0.18);
}

.deleted-items-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid #ededed;
  background: #fff;
}

.deleted-items-summary div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #ededed;
  border-radius: 7px;
  background: #f7f7f5;
}

.deleted-items-summary strong {
  font-size: 18px;
}

.deleted-items-summary span {
  color: #787774;
  font-size: 12px;
  font-weight: 600;
}

.deleted-items-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding: 18px 22px 22px;
  scrollbar-width: thin;
}

.deleted-item-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid #ededed;
}

.deleted-item-type {
  display: inline-grid;
  min-height: 26px;
  place-items: center;
  border-radius: 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.deleted-item-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.deleted-item-main strong,
.deleted-item-main span,
.deleted-item-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deleted-item-main span,
.deleted-item-date {
  color: #787774;
  font-size: 12px;
  font-weight: 600;
}

.deleted-items-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: #787774;
  text-align: center;
}

@media (max-width: 980px) {
  .login-screen {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-visual {
    min-height: 340px;
    padding: 36px 28px;
  }

  .login-word span {
    font-size: clamp(52px, 15vw, 96px);
  }

  .login-tagline {
    font-size: clamp(19px, 4.4vw, 26px);
  }

  .login-subcopy {
    font-size: 13.5px;
  }

  .login-panel {
    min-height: calc(100vh - 340px);
    padding: 30px 24px 36px;
  }

  .account-settings-modal {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    min-height: 0;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid #ededed;
  }

  .settings-tabs button {
    text-align: center;
  }

  .settings-panel {
    padding: 20px 22px 26px;
  }

  .settings-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-actions {
    margin: 0;
    padding: 12px 16px;
  }

  .folder-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .folder-item-grid.list-mode .folder-card-open {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .folder-list-header {
    display: none;
  }

  .folder-item-grid.list-mode .folder-card-type {
    display: none;
  }

  .folder-item-grid.list-mode .folder-card-count,
  .folder-item-grid.list-mode .folder-card-date {
    grid-column: 2;
    font-size: 11px;
  }

  .settings-check-grid,
  .report-template-preview,
  .report-designer-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.progress-dialog strong {
  font-size: 15px;
}

.progress-dialog span {
  color: var(--muted);
  font-size: 12px;
}

.progress-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e2eaec;
}

.progress-bar div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.progress-dialog em {
  justify-self: end;
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.book-item.dragging,
.page-break-item.dragging {
  opacity: 0.42;
}

.book-item.drag-over,
.page-break-item.drag-over {
  position: relative;
}

.book-item-focused {
  border-color: var(--accent) !important;
  background: #f2fbfb;
  box-shadow: 0 0 0 3px rgba(23, 107, 111, 0.18);
}

.book-item.drag-over::before,
.page-break-item.drag-over::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -9px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 111, 0.14);
}

.book-pages.layout-1 .book-page-grid {
  grid-template-columns: minmax(0, 1fr);
}

.book-pages.layout-2 .book-page-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.book-pages.layout-3 .book-page-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.book-pages.layout-3 .book-item .thumb {
  min-height: 135px;
}

.book-pages.layout-4 .book-page-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.book-pages.layout-4 .book-item .thumb {
  min-height: 110px;
}

.book-item-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.book-item .thumb {
  min-height: 170px;
}

.plain-photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.book-blackboard {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
  overflow: hidden;
  display: grid;
  grid-template-columns: max-content 1fr;
}

.prop-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: stretch;
  border-bottom: 1px solid var(--panel-2);
}

.prop-row:last-child {
  border-bottom: none;
}

.prop-label {
  padding: 5px 8px 5px 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 10px;
  white-space: nowrap;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  user-select: none;
}

.prop-val {
  padding: 5px 8px;
  word-break: break-all;
  font-size: 11px;
  line-height: 1.55;
}

.prop-val-auto {
  padding: 5px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  display: flex;
  align-items: center;
}

.prop-val-input {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink);
  transition: background 0.12s;
  box-sizing: border-box;
}

.prop-val-input::placeholder {
  color: var(--line);
}

.prop-val-input:hover {
  background: var(--accent-soft);
}

.prop-val-input:focus {
  background: #fffde8;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.prop-val-area {
  resize: none;
  min-height: 52px;
  line-height: 1.55;
}

/* レイアウト3・4枚では少し詰める */
.book-pages.layout-3 .book-blackboard,
.book-pages.layout-4 .book-blackboard {
  font-size: 9px;
}

.book-pages.layout-3 .prop-label,
.book-pages.layout-4 .prop-label {
  font-size: 9px;
  padding: 3px 6px 3px 6px;
}

.book-pages.layout-3 .prop-val,
.book-pages.layout-3 .prop-val-auto,
.book-pages.layout-3 .prop-val-input,
.book-pages.layout-4 .prop-val,
.book-pages.layout-4 .prop-val-auto,
.book-pages.layout-4 .prop-val-input {
  font-size: 9px;
  padding: 3px 6px;
}

.book-pages.layout-3 .prop-val-area,
.book-pages.layout-4 .prop-val-area {
  min-height: 30px;
}

.book-blackboard.book-blackboard-muted {
  border-left-color: var(--line);
  background: var(--panel-2);
  padding: 8px;
  font-size: 11px;
  color: var(--muted);
}

.book-pages.layout-3 .book-blackboard .bb-content-bd,
.book-pages.layout-4 .book-blackboard .bb-content-bd {
  min-height: 36px;
  font-size: 9px;
  line-height: 1.5;
}

.book-pages.layout-1 .book-blackboard .bb-content-bd,
.book-pages.layout-2 .book-blackboard .bb-content-bd {
  min-height: 52px;
}

.book-item-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.book-caption-field {
  display: none;
  gap: 5px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.book-caption-field input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.book-caption-field input:focus {
  border-color: #93caca;
  outline: 2px solid rgba(23, 107, 111, 0.13);
}

.icon-action {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
}

.icon-action:hover {
  color: #8a3d35;
  border-color: #e2b9b2;
  background: #fff4f2;
}

.icon-action.neutral:hover {
  color: var(--accent-strong);
  border-color: #93caca;
  background: #f2fbfb;
}

.empty-book {
  display: grid;
  grid-column: 1 / -1;
  min-height: 320px;
  place-items: center;
  border: 1px dashed #b8c8cc;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
  text-align: center;
}

.empty-book strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(400px, 1fr));
  gap: 12px;
  align-items: start;
}

.search-results.compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.search-scope-bar {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(140px, 0.9fr) minmax(170px, 1fr) minmax(240px, 1.4fr) auto;
  gap: 6px;
  align-items: center;
  margin: 6px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-scope-bar.has-pin-scope {
  grid-template-columns: minmax(130px, 0.8fr) minmax(140px, 0.9fr) minmax(160px, 1fr) minmax(120px, 0.8fr) minmax(220px, 1.3fr) auto;
}

.search-scope-control {
  position: relative;
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  color: #5f6b72;
  background: #f1f4f5;
  font-size: 12px;
  font-weight: 800;
}

.search-scope-control span {
  flex: 0 0 auto;
  line-height: 1;
}

.search-scope-control .scope-icon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  color: #758589;
}

.search-scope-control .scope-icon:empty {
  display: none;
}

.search-scope-control .scope-icon svg {
  display: block;
  width: 15px;
  height: 15px;
}

.search-scope-control.is-disabled {
  background: #f7f9f9;
  color: #9aa8ad;
  opacity: 1;
}

.search-scope-bar input,
.scope-menu-button {
  width: 100%;
  min-width: 0;
  min-height: 22px;
  padding: 0;
  border: 0;
  outline: 0;
  color: #26494d;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.scope-menu-button {
  overflow: hidden;
  border: 0;
  color: #26494d;
  background: transparent;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.scope-menu-button:hover {
  background: transparent;
}

.scope-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 35;
  display: grid;
  gap: 2px;
  width: max(220px, 100%);
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #dde6e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(19, 36, 42, 0.12);
}

.scope-menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.scope-menu-item:hover,
.scope-menu-item.selected {
  background: #f1f4f5;
}

.scope-menu-icon,
.scope-menu-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  color: #758589;
}

.scope-menu-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-scope-bar input::placeholder {
  color: #8d969b;
  font-weight: 500;
}

.search-scope-bar > .primary-action {
  min-height: 30px;
  align-self: center;
  margin-left: 2px;
  padding-inline: 14px;
  border-color: #a7d2d2;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 700;
}

.search-scope-bar > .primary-action:hover {
  border-color: #93caca;
  background: #e7f7f7;
}

.search-action-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.search-action-toolbar.has-selection {
  border-color: #a7d2d2;
  background: #f2fbfb;
}

.search-action-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  min-width: 0;
}

.search-action-heading strong {
  color: var(--ink);
  font-size: 13px;
}

.search-action-heading span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.search-action-toolbar button:disabled,
.search-action-toolbar select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.search-result {
  display: grid;
  position: relative;
  align-content: start;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  cursor: pointer;
}

.search-result:hover {
  border-color: #93caca;
  background: #f2fbfb;
}

.search-result.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(23, 107, 111, 0.35);
}

.search-result > span {
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.search-result strong {
  font-size: 15px;
}

.search-result p {
  margin: 0;
}

.search-result-photo {
  grid-template-columns: minmax(150px, 168px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 0;
}

.search-select-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid rgba(219, 227, 230, 0.92);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 14px rgba(19, 36, 42, 0.08);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.search-select-photo input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
}

.search-result.selected .search-select-photo {
  border-color: #93caca;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.search-result-photo.compact {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 10px;
}

.search-photo-thumb {
  display: grid;
  grid-template-rows: auto auto;
  gap: 7px;
  min-width: 0;
}

.search-photo-thumb .thumb {
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  margin: 0;
}

.search-result-photo.compact .search-photo-thumb {
  gap: 6px;
}

.search-result-photo.compact .search-photo-thumb .thumb {
  min-height: 0;
  aspect-ratio: 4 / 3;
}

.search-photo-thumb span,
.search-tags {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-photo-info {
  display: grid;
  align-self: start;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.search-photo-compact-info {
  display: grid;
  align-self: start;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.search-photo-compact-info strong,
.search-photo-compact-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-photo-compact-info strong {
  font-size: 13px;
}

.search-photo-compact-info small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.search-photo-compact-info .search-result-header {
  min-height: 22px;
}

.search-memberships {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.search-memberships-wrap {
  display: grid;
  align-self: start;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.search-membership-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.relation-inline-add {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  background: #fff;
  box-shadow: 0 4px 10px rgba(19, 36, 42, 0.06);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.relation-inline-add:hover {
  border-color: #93caca;
  background: var(--accent-soft);
}

.search-memberships.empty {
  width: max-content;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 900;
}

.search-membership-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 3px 8px;
  align-items: center;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.search-membership-row span {
  display: inline-flex;
  grid-row: 1 / 4;
  align-self: start;
  width: 22px;
  height: 22px;
  gap: 4px;
  justify-content: center;
  align-items: center;
  padding: 0;
  border-radius: 5px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 900;
}

.search-membership-row span svg {
  display: block;
  width: 13px;
  height: 13px;
}

.search-membership-row strong,
.search-membership-row small,
.search-membership-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-membership-row em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.search-membership-row strong {
  font-size: 12px;
}

.search-membership-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.search-memberships.compact {
  gap: 3px;
}

.search-memberships.compact .search-membership-row {
  grid-template-columns: 24px minmax(0, 1fr);
  padding: 4px 6px;
}

.search-memberships.compact .search-membership-row small {
  display: none;
}

.search-memberships.compact .search-membership-row.pin-relation small {
  display: block;
}

.search-result-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.search-result-header span,
.search-result-header em {
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.search-result-header .muted-chip {
  color: var(--muted);
  background: var(--panel-2);
}

.search-blackboard-list {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.search-blackboard-list div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 25px;
  border-bottom: 1px solid var(--line);
}

.search-blackboard-list div:last-child {
  border-bottom: 0;
}

.search-blackboard-list dt,
.search-blackboard-list dd {
  margin: 0;
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.35;
}

.search-blackboard-list dt {
  color: var(--muted);
  background: var(--panel-2);
  font-weight: 800;
}

.search-blackboard-list dd {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .search-results:not(.compact) {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-scope-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .search-scope-control {
    border-right: 0;
    border-bottom: 0;
  }

  .search-scope-bar > .primary-action {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .search-scope-bar,
  .search-action-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-scope-bar {
    gap: 6px;
  }

  .search-scope-control {
    border-right: 0;
    border-bottom: 0;
  }

  .search-scope-bar > .primary-action {
    margin-left: 0;
  }

  .photo-relation-add,
  .relation-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-result-photo {
    grid-template-columns: minmax(0, 1fr);
  }
}

.book-photo-result-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.book-photo-result-main strong,
.book-photo-result-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-photo-result-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.book-photo-status {
  justify-self: end;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.book-photo-status.ok {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.book-photo-status.warn {
  color: #8a5a12;
  background: #fff1d6;
}

@media (max-width: 980px) {
  .book-filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 狭幅（ノートPC等）では詳細パネルの固定幅がメインパネルを潰すため段階的に縮小・縦積みする */
@media (max-width: 1240px) {
  .photo-layout,
  .book-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1100px) {
  .photo-layout,
  .book-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-layout .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  body:not(.login-active) {
    overflow-x: hidden;
  }

  body.sidebar-menu-open {
    overflow: hidden;
  }

  .app-shell,
  body.drawing-mode .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  body.drawing-mode .sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    width: min(320px, 86vw);
    height: auto;
    padding: 16px;
    box-shadow: 18px 0 38px rgba(19, 36, 42, 0.28);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  body.sidebar-menu-open .sidebar,
  body.drawing-mode.drawing-menu-open .sidebar {
    transform: translateX(0);
  }

  .workspace,
  body.drawing-mode .workspace {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    gap: 8px;
    padding: 6px 12px;
  }

  .topbar-left {
    flex: 0 1 auto;
    gap: 8px;
  }

  .header-menu-button {
    display: inline-flex;
  }

  .topbar-brand-name {
    display: none;
  }

  .app-tab-bar {
    flex: 1 1 auto;
    min-width: 72px;
  }

  .app-tab {
    max-width: 150px;
  }

  .topbar-search .topbar-search-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .view {
    padding: 14px;
  }

  .content-grid,
  .photo-layout,
  .drawing-layout,
  .book-layout,
  .folder-content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .main-panel,
  .detail-panel {
    padding: 14px;
  }

  .section-heading,
  .panel-row {
    align-items: flex-start;
    gap: 12px;
  }

  .folder-item-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .folder-card-open {
    padding: 30px 12px 12px;
  }

  .book-layout .detail-panel {
    position: static;
    max-height: none;
  }

  .book-actions,
  .blackboard-actions,
  .relation-panel-heading,
  .book-page-header {
    justify-content: flex-start;
  }

  .book-page {
    padding: 18px;
    box-shadow: inset 0 0 0 8px #f2f4f5;
  }

  .book-pages.layout-3 .book-page-grid,
  .book-pages.layout-4 .book-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.drawing-mode.panel-open .drawing-canvas {
    margin-right: 0;
  }

  body.drawing-mode .pin-drawer {
    width: min(340px, 88vw);
    z-index: 30;
  }

  body.drawing-mode #view-drawing .section-heading {
    left: 10px;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-height: 48px;
  }

  body {
    font-size: 13px;
  }

  .topbar {
    min-height: var(--topbar-height);
    padding: 7px 10px;
  }

  .header-menu-button {
    display: inline-grid;
    width: 34px;
    padding: 0;
    place-items: center;
  }

  .header-menu-label,
  .header-title,
  .app-tab-label {
    display: none;
  }

  .app-tab {
    max-width: 70px;
  }

  .app-tab-open {
    padding: 5px 5px 5px 7px;
  }

  .app-tab-close {
    display: grid;
    width: 24px;
    height: 28px;
    margin: 0 3px 0 0;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0 7px 7px 0;
  }

  .app-tab-close svg {
    width: 12px;
    height: 12px;
  }

  .view {
    padding: 10px;
  }

  .main-panel,
  .detail-panel {
    padding: 12px;
    border-radius: 8px;
  }

  .section-heading,
  .panel-row,
  .folder-heading,
  .book-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  h2 {
    font-size: 18px;
  }

  .folder-toolbar,
  .folder-selection-actions,
  .book-actions,
  .blackboard-actions {
    width: 100%;
  }

  .folder-toolbar > *,
  .folder-selection-actions button,
  .book-actions > button,
  .blackboard-actions > button {
    flex: 1 1 auto;
  }

  #view-book .section-heading {
    flex-direction: row;
    align-items: center;
  }

  #view-book .book-actions {
    width: auto;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 8px;
  }

  #view-book .book-actions > button,
  #view-book .book-actions > .switch-button {
    flex: 0 0 auto;
    width: auto;
  }

  #view-book .book-blackboard-switch {
    min-width: 92px;
  }

  #view-book .book-page-header {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  #view-book .book-page-header span {
    margin-left: auto;
  }

  #view-book .add-blank-slot-btn {
    flex: 0 0 auto;
    width: auto;
  }

  .folder-item-grid,
  .folder-item-grid.list-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .folder-card-icon {
    width: 36px;
    height: 36px;
  }

  .book-page {
    padding: 12px;
    box-shadow: inset 0 0 0 6px #f2f4f5;
  }

  .book-page-grid,
  .book-pages.layout-2 .book-page-grid,
  .book-pages.layout-3 .book-page-grid,
  .book-pages.layout-4 .book-page-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .book-pages.layout-1 .book-page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-pages.has-blackboard .book-page-grid,
  .book-pages.has-blackboard.layout-2 .book-page-grid,
  .book-pages.has-blackboard.layout-3 .book-page-grid,
  .book-pages.has-blackboard.layout-4 .book-page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-item .thumb,
  .book-pages.layout-3 .book-item .thumb,
  .book-pages.layout-4 .book-item .thumb {
    min-height: 82px;
    margin-bottom: 6px;
  }

  .book-pages.has-blackboard .book-item .thumb,
  .book-pages.has-blackboard.layout-3 .book-item .thumb,
  .book-pages.has-blackboard.layout-4 .book-item .thumb {
    min-height: 150px;
  }

  #view-book .book-item {
    padding: 8px;
  }

  #view-book .plain-photo-button .thumb,
  #view-book .blank-slot-thumb {
    margin-bottom: 6px;
  }

  #view-book .book-item-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: start;
  }

  #view-book .book-item-header h3 {
    margin: 0;
    color: var(--ink);
    font-size: 10.5px;
    line-height: 1.35;
    white-space: nowrap;
  }

  #view-book .book-item-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  #view-book .icon-action {
    width: 100%;
    height: 30px;
    min-width: 0;
    border-radius: 7px;
  }

  #view-book .book-pages.has-blackboard .book-item-controls {
    margin-bottom: 10px;
  }

  #view-book .book-pages.has-blackboard .book-blackboard {
    margin-top: 0;
  }

  #view-book .book-empty-slot {
    min-height: 136px;
    padding: 8px;
    align-content: center;
    gap: 4px;
  }

  #view-book .book-empty-slot strong {
    margin-bottom: 0;
    font-size: 12px;
  }

  #view-book .book-empty-slot span {
    font-size: 10.5px;
    line-height: 1.35;
    white-space: nowrap;
  }

  .book-command-search,
  .pin-number-row,
  .bb-size-row,
  .bb-add-inline,
  .relation-pin-select-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-photo-results {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-stage {
    min-height: 0;
  }

  .mock-photo,
  .drawing-canvas,
  .relation-drawing-canvas {
    max-width: 100%;
  }

  body.drawing-mode #view-drawing .section-heading {
    top: calc(var(--topbar-height) + 8px);
    left: 8px;
  }

  body.drawing-mode .drawing-toolbox {
    width: 44px;
    padding: 6px;
  }
}
