:root{
  --ink:#1c1d21;
  --ink-soft:#2b2d33;
  --paper:#eeece6;
  --paper-card:#fbfaf7;
  --paper-line:#d8d4c9;
  --stamp-red:#a83e3e;
  --stamp-red-bg:#f5e2df;
  --indigo:#2f4a5e;
  --indigo-bg:#e3ebee;
  --moss:#3f6b4f;
  --moss-bg:#e2ecdf;
  --ochre:#8a6a2a;
  --ochre-bg:#f1e6cb;
  --text-main:#232323;
  --text-sub:#6f6b62;
  --radius-s:4px;
  --serif:'Shippori Mincho', serif;
  --sans:'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--sans);
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  margin: 0;
  transition: background 0.3s;
  -webkit-font-smoothing: antialiased;
}

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ===== サイドバー ===== */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--ink);
  color: #e9e7e0;
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: width .22s ease, flex-basis .22s ease;
}
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.sidebar.collapsed { width: 64px; flex-basis: 64px; }
.sidebar.collapsed .brand-label,
.sidebar.collapsed .proj-switch,
.sidebar.collapsed .sidebar-prop,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .lang-select-sidebar,
.sidebar.collapsed .plan-block { display: none; }

.collapse-btn {
  position: absolute;
  top: 50%; right: -12px;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid rgba(255,255,255,.25);
  color: #cfcdc4;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 520;
  box-shadow: 2px 0 6px rgba(0,0,0,.25);
}
.collapse-btn:hover { border-color: #38bdf8; color: #38bdf8; background: rgba(56,189,248,.12); }

.sidebar-top { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #5eb8f5;
  display: flex; align-items: center; gap: 9px;
  white-space: nowrap; overflow: hidden;
  margin-bottom: 4px;
}
.brand-mark { display: flex; align-items: center; flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(56,189,248,.55)); }

.proj-switch {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-s);
  padding: 4px 4px 4px 10px;
}
.proj-switch:hover { background: rgba(255,255,255,.09); }
.proj-select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #f2f0e9;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 2px;
  cursor: pointer;
  outline: none;
}
.proj-select option { color: #1c1d21; }
.edit-project-btn { background: none; border: none; cursor: pointer; font-size: 13px; opacity: .7; padding: 4px; border-radius: 4px; color: #cfcdc4; flex-shrink: 0; }
.edit-project-btn:hover { opacity: 1; background: rgba(255,255,255,.1); }

.sidebar-prop { margin-top: 10px; }
.sidebar-prop label { display: block; font-size: 10.5px; color: #8b8676; margin-bottom: 3px; }
.sidebar-prop select {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-s);
  color: #f2f0e9;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 6px 8px;
  cursor: pointer;
  outline: none;
}
.sidebar-prop select option { color: #1c1d21; }

.history-group { display: flex; gap: 6px; }
.history-btn { flex: 1; background: var(--paper-card); color: #a0aec0; border: 1px solid var(--paper-line); padding: 6px 10px; font-size: 12px; font-weight: bold; border-radius: var(--radius-s); cursor: not-allowed; transition: all .15s; }
.history-btn.active { background: #e6f3fb; color: #0079bf; border-color: #b8dff5; cursor: pointer; }

.sidebar-section { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.section-label { font-size: 10.5px; color: #8b8676; margin-bottom: 10px; letter-spacing: .04em; }
.member-list-sidebar { display: flex; flex-wrap: wrap; gap: 6px; }
.invite-link { font-size: 12px; color: #5eb8f5; cursor: pointer; margin-top: 8px; display: inline-block; }
.invite-link:hover { text-decoration: underline; }

.sidebar-nav { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); }
.nav-item { display: flex; align-items: center; padding: 10px 16px; font-size: 11.5px; color: #b5b2a8; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #f2f0e9; }
.lang-select-sidebar { background: transparent; border: none; color: #b5b2a8; font-size: 11.5px; cursor: pointer; outline: none; width: 100%; }
.lang-select-sidebar option { color: #1c1d21; }

.plan-block { padding: 14px 16px 18px; }

/* ===== メインカラム ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(251, 250, 247, .82);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--paper-line);
  padding: 10px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.topbar-props { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prop { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-sub); font-weight: bold; }
.prop select { font-family: var(--sans); font-size: 12.5px; color: var(--text-main); background: transparent; border: none; border-bottom: 1px solid var(--paper-line); padding: 2px 2px 3px; cursor: pointer; font-weight: normal; }
.prop select:focus { outline: 2px solid var(--indigo); outline-offset: 2px; }
.divider { width: 1px; height: 16px; background: var(--paper-line); }

.swatch-image {
  background: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 5px;
  font-size: 11.5px; font-weight: bold;
  color: var(--text-sub);
  border: 1px dashed var(--paper-line);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.swatch-image:hover { border-color: #9c9686; color: var(--text-main); }
.thumbicon { width: 13px; height: 13px; border-radius: 2px; background: linear-gradient(135deg,#dfe6e2,#c9d2cc); flex: 0 0 13px; }

.dropdown-menu-wrapper { position: relative; display: inline-block; }
.dropdown-btn { background: var(--paper-card); color: var(--text-main); border: 1px solid var(--paper-line); padding: 6px 13px; font-size: 12.5px; font-weight: bold; border-radius: var(--radius-s); cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 4px; }
.dropdown-btn:hover { border-color: #9c9686; }

.action-btn { border: none; padding: 6px 13px; font-weight: bold; border-radius: var(--radius-s); cursor: pointer; transition: all .15s; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.action-btn.primary { background: #0079bf; color: #fff; }
.action-btn.primary:hover { background: #06649e; }
.action-btn.secondary { background: var(--paper-card); color: var(--text-main); border: 1px solid var(--paper-line); }
.action-btn.secondary:hover { border-color: #9c9686; }

/* ===== キャンバス ===== */
.canvas { flex: 1; padding: 20px 26px 40px; overflow-y: auto; }

.export-header-info { margin-bottom: 4px; }
.doc-title { font-family: var(--sans); font-size: 21px; font-weight: 600; color: var(--text-main); margin: 4px 0 2px; }
.doc-sub { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.export-header-members { font-size: 11.5px; color: var(--text-sub); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.daiwari-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-items: stretch; }
.daiwari-grid.rtl-grid { direction: rtl; }
.daiwari-grid.rtl-grid .pair-container { direction: ltr; }

.pair-container {
  display: flex;
  flex-direction: column;
  background: rgba(251, 250, 247, .82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(30,28,20,.05), 0 6px 14px -8px rgba(30,28,20,.18);
  position: relative;
  overflow: visible !important;
  height: auto;
  min-height: 185px;
}


.pair-body { display: flex; flex: 1; min-height: 165px; position: relative; width: 100%; box-sizing: border-box; padding: 12px 12px 14px; gap: 0; align-items: stretch; }
.pair-body::before {
  content: "";
  position: absolute;
  left: 50%; top: 12px; bottom: 14px;
  width: 0;
  border-left: 1px dotted #c7c2b3;
}

.page-box { flex: 1; height: 100%; background: transparent; padding: 0; display: flex; flex-direction: column; justify-content: flex-start; align-content: flex-start; gap: 4px; box-sizing: border-box; width: 50%; min-height: 145px; }
.page-box:first-child { padding-right: 12px; }
.page-box:last-child { padding-left: 12px; }
.page-box.drag-over { background: rgba(227, 235, 238, .8) !important; border-radius: 3px; outline: 2px dashed var(--indigo); }

.page-label { width: 100%; font-size: 10.5px; font-weight: bold; color: var(--text-sub); margin-bottom: 8px; text-align: left; pointer-events: none; position: relative; z-index: 10; display: flex; justify-content: space-between; }

.layout-card { background: rgba(251, 250, 247, .88); backdrop-filter: blur(4px); border: 1px solid var(--paper-line); border-radius: 2px; width: 100%; padding: 8px; box-shadow: 0 1px 2px rgba(30,28,20,.06); font-size: 11px; cursor: grab; user-select: none; box-sizing: border-box; transition: all .15s; z-index: 2; position: relative; }
body.read-only-mode .layout-card { cursor: default; }
body.read-only-mode #addCardBtn, body.read-only-mode #openSortModalBtn { opacity: .5; cursor: not-allowed; }
.layout-card:hover { box-shadow: 0 3px 8px rgba(30,28,20,.14); border-color: var(--indigo); }
.layout-card.selected { border: 1.5px solid var(--indigo) !important; background: var(--indigo-bg) !important; }
.layout-card:active { cursor: grabbing; }

/* 見開きカード (通常カードと枠線・影を統一) */
.pair-body .layout-card.layout-spread {
  position: absolute !important;
  top: 34px !important;
  left: 12px !important;
  right: 12px !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  z-index: 100 !important;
  border: 1px solid var(--paper-line) !important;
  box-shadow: 0 1px 2px rgba(30,28,20,.06) !important;
  background: rgba(251, 250, 247, .88) !important;
  backdrop-filter: blur(4px);
  box-sizing: border-box !important;
  padding: 8px !important;
}

.card-thumb-img {
  width: 100% !important;
  max-height: 85px !important;
  height: auto !important;
  object-fit: contain !important;
  aspect-ratio: 4 / 3 !important;
  background: var(--paper-card);
  border-radius: 2px;
  margin: 0 auto 8px auto;
  border: 1px solid var(--paper-line);
  display: block;
  pointer-events: none;
}

.card-badges-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; min-height: 18px; align-items: center; }
.card-badge { display: inline-block; background: var(--ochre-bg); color: var(--ochre); padding: 2px 7px; border-radius: 2px; font-weight: 600; font-size: 10px; border: 1px solid #e1cf9c; }
.card-badge.card-badge-status { border-radius: 2px !important; }

.card-title { font-weight: 500; font-size: 11.5px; color: var(--text-main); word-break: break-all; line-height: 1.4; pointer-events: none; }
.card-footer { margin-top: 4px; font-size: 10px; color: var(--text-sub); display: flex; justify-content: flex-start; font-weight: bold; }

.sortable-card-list { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow-y: auto; padding: 4px; }
.sort-item { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--paper-line); padding: 6px 12px; border-radius: 6px; cursor: grab; font-size: 12px; user-select: none; transition: background .15s; }
.sort-item:hover { background: var(--indigo-bg); border-color: var(--indigo); }
.sort-item.dragging { opacity: .4; background: var(--indigo-bg); border: 2px dashed var(--indigo); }
.sort-item-info { display: flex; align-items: center; gap: 10px; }
.sort-thumb-mini { width: 32px; height: 32px; object-fit: contain; background: #f8f9fa; border: 1px solid var(--paper-line); border-radius: 3px; }
.sort-thumb-empty { width: 32px; height: 32px; background: #eef2f7; border: 1px dashed var(--paper-line); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #a0aec0; }
.sort-page-tag { background: var(--indigo); color: white; padding: 2px 8px; border-radius: 10px; font-weight: bold; font-size: 11px; min-width: 42px; text-align: center; }
.sort-page-tag.empty-tag { background: #94a3b8; }
.sort-item-actions { display: flex; gap: 4px; }
.sort-btn { background: #f4f5f7; border: 1px solid var(--paper-line); padding: 2px 8px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 11px; }
.sort-btn:hover { background: var(--indigo); color: white; border-color: var(--indigo); }

.extra-section { display: flex; flex-direction: column; gap: 16px; border-top: 1px dashed var(--paper-line); padding-top: 20px; margin-top: 28px; }
.extra-area-title { font-family: var(--sans); font-size: 13.5px; color: var(--text-main); margin: 0 0 8px 0; }

.extra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; background: rgba(0,0,0,.02); padding: 12px; border-radius: 6px; min-height: 80px; border: 1px solid var(--paper-line); }
.extra-grid.drag-over { outline: 2px dashed var(--indigo); }
.chushi-grid { background: var(--stamp-red-bg); border: 1px dashed #e0bcb6; }

.footer-note { margin-top: 34px; font-size: 11.5px; color: var(--text-sub); border-top: 1px solid var(--paper-line); padding-top: 14px; text-align: center; }

/* ===== メンバータグ ===== */
.collaborator-box { background: var(--paper-card); padding: 10px 14px; border-radius: 6px; border: 1px solid var(--paper-line); }
.member-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.member-tag { background: var(--indigo-bg) !important; color: var(--indigo) !important; font-weight: bold; font-size: 12px; padding: 4px 10px; border-radius: 12px; border: 1px solid #c3d1d8 !important; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: all .15s; }
.member-tag:hover { background: #d3e0e5 !important; }
.remove-member-btn { color: var(--stamp-red); border: none; background: none; font-weight: bold; cursor: pointer; font-size: 11px; margin-left: 2px; }
.remove-member-btn:hover { color: #8f3535; }

.chat-section { margin-top: 10px; border-top: 1px solid var(--paper-line); padding-top: 10px; }
.chat-thread-box { background: #fafbfc; border: 1px solid var(--paper-line); border-radius: 6px; padding: 8px 12px; max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chat-message-item { background: #fff; border: 1px solid #e2e8f0; padding: 5px 8px; border-radius: 4px; font-size: 11px; line-height: 1.4; }
.chat-msg-header { display: flex; justify-content: space-between; font-weight: bold; color: var(--indigo); margin-bottom: 2px; font-size: 10px; }
.chat-msg-time { color: #a0aec0; font-weight: normal; }
.chat-input-row { display: flex; gap: 6px; }

.mention-suggest-popover { display: none; position: absolute; bottom: 100%; left: 0; width: 100%; background: #ffffff; border: 1px solid var(--paper-line); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 10000; max-height: 140px; overflow-y: auto; margin-bottom: 4px; }
.mention-item { padding: 8px 12px; font-size: 12px; color: #2d3748; cursor: pointer; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #edf2f7; }
.mention-item:hover { background-color: var(--indigo-bg); color: var(--indigo); font-weight: bold; }

.link-input-row { display: flex; gap: 6px; }
.link-input-row input[type="text"] { flex: 1; }
.link-input-row input[type="url"] { flex: 1.5; }

.links-list-container { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.link-item-box { background: #f4f5f7; border: 1px solid #dfe1e6; padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.link-item-box a { color: var(--indigo); text-decoration: underline; font-weight: bold; }
.remove-link-btn { color: var(--stamp-red); background: none; border: none; font-weight: bold; cursor: pointer; font-size: 11px; }

/* ===== モーダル共通 ===== */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(28,29,33,.6); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-backdrop.active { display: flex !important; z-index: 10000 !important; }

.modal-content.modal-maximized { background: var(--paper-card); border-radius: 8px; width: 1350px; max-width: 98vw; box-shadow: 0 16px 40px rgba(0,0,0,.35); overflow: hidden; display: flex; flex-direction: column; }
.modal-content.modal-small { background: var(--paper-card); border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); overflow: hidden; }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--paper-line); }
.modal-title-zone { display: flex; align-items: center; gap: 12px; }
.modal-header h3 { margin: 0; font-size: 15.5px; color: var(--text-main); font-family: var(--sans); font-weight: 600; }
.modal-page-badge { background: var(--indigo); color: #fff; padding: 4px 12px; border-radius: 14px; font-size: 13px; font-weight: bold; }
.modal-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--text-sub); }

.modal-body-split { display: flex; gap: 24px; padding: 20px 24px; max-height: 85vh; overflow-y: auto; }
.modal-body-padding { padding: 20px; display: flex; flex-direction: column; gap: 12px; }

.modal-left-col { flex: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
.modal-right-col { flex: 1.2; display: flex; flex-direction: column; gap: 12px; }

.preview-nav-wrapper { display: flex; align-items: center; gap: 12px; width: 100%; height: 100%; }
.nav-arrow-btn { background: none; border: none; color: var(--indigo); width: 32px; height: 32px; font-size: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; flex-shrink: 0; transition: color .15s, transform .15s; }
.nav-arrow-btn:hover { color: #0079bf; transform: scale(1.15); }

.thumbnail-dropzone { flex: 1; border: 2px dashed var(--indigo); border-radius: 6px; padding: 6px; text-align: center; cursor: pointer; background: var(--paper); transition: background .15s; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.thumbnail-dropzone:hover { background: var(--indigo-bg); }

.thumb-preview-box { display: flex; justify-content: center; align-items: center; height: 680px; width: 100%; background: #f8f9fa; border-radius: 4px; overflow: hidden; padding: 2px; box-sizing: border-box; }
.thumb-preview-box img { width: 100%; height: 100%; object-fit: contain; border-radius: 3px; box-shadow: 0 6px 20px rgba(0,0,0,.15); display: block; }
.thumb-placeholder { font-size: 13px; color: var(--text-sub); line-height: 1.6; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: bold; color: var(--ink-soft); }
.form-group input, .form-group textarea, .form-group select { padding: 8px; border: 1px solid var(--paper-line); border-radius: 3px; font-size: 12px; font-family: var(--sans); background: #fff; }
.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

.file-attachments-list { font-size: 11px; display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.file-attachment-item { background: var(--indigo-bg); border: 1px solid #c3d1d8; color: var(--indigo); padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }
.remove-file-btn { color: var(--stamp-red); cursor: pointer; font-weight: bold; margin-left: 8px; font-size: 12px; border: none; background: none; }

.conflict-options { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.conflict-btn { background: #fafbfc; border: 1px solid var(--paper-line); padding: 10px 14px; text-align: left; border-radius: 4px; font-weight: bold; color: var(--text-main); cursor: pointer; transition: all .15s; }
.conflict-btn:hover { background: var(--indigo); color: #fff; border-color: var(--indigo); }

.modal-footer { display: flex; justify-content: space-between; padding: 14px 24px; background: var(--paper); border-top: 1px solid var(--paper-line); }
.btn-primary { background: #0079bf; color: #fff; border: none; padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-primary:hover { background: #06649e; }
.btn-danger { background: #0079bf; color: #fff; border: none; padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.btn-danger:hover { background: #06649e; }
.btn-secondary { background: var(--paper); color: var(--text-main); border: 1px solid var(--paper-line); padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-secondary:hover { border-color: #9c9686; }
.danger-text { color: var(--stamp-red); background: none; border: none; cursor: pointer; }

/* ラベル(ステータス)チップの行スタイル */
.status-chip-row { display: inline-flex; align-items: center; gap: 4px; }

/* カラーパレット自動折り返し */
.status-color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 6px; }

/* ラベル作成モーダル */
.status-preview-bar { height: 56px; border-radius: 4px; margin-bottom: 4px; transition: background .15s; }
.status-color-swatch { width: 100%; min-width: 0; aspect-ratio: 1 / 1; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.status-color-swatch:hover { transform: scale(1.06); }
.status-color-swatch.selected { border-color: var(--ink); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }

/* 拡大モーダル(カード詳細編集)のXボタンは常に画面右上に固定表示 */
.modal-content.modal-maximized .modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .sidebar { position: fixed; height: 100vh; }
  .main { margin-left: 64px; }
  .topbar { padding: 10px 16px; }
  .canvas { padding: 16px; }
}

@media (max-width: 1024px) {
  .modal-content.modal-maximized { width: 96vw; }
  .modal-body-split { flex-direction: column; }
  .modal-left-col, .modal-right-col { flex: none; width: 100%; }
  .thumb-preview-box { height: 300px; }
}
