body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #b0b3b8;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  margin: 16px 24px;
  color: #172b4d;
  transition: background 0.3s;
}

.header-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex-wrap: wrap;
  position: relative;
  z-index: 500;
}

.title-zone { display: flex; align-items: center; gap: 12px; }

.project-selector-wrapper { display: flex; align-items: center; gap: 8px; }
.project-dropdown { padding: 5px 10px; font-size: 13px; font-weight: bold; border: 1.5px solid #0079bf; border-radius: 6px; background: #fff; color: #0079bf; cursor: pointer; outline: none; }
.delete-project-btn { background: none; border: none; cursor: pointer; font-size: 15px; opacity: 0.6; padding: 4px; border-radius: 4px; transition: all 0.2s; }
.delete-project-btn:hover { opacity: 1; background: #ffebe6; color: #ff4757; }

.project-title-wrapper { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.2s; }
.project-title-wrapper:hover { background: rgba(0,0,0,0.05); }

h1 { font-size: 18px; margin: 0; color: #0079bf; font-weight: 700; }
.edit-icon { font-size: 12px; opacity: 0.5; }

.history-group { display: flex; gap: 4px; background: #e2e8f0; padding: 3px; border-radius: 6px; }
.history-btn { background: transparent; color: #a0aec0; border: none; padding: 5px 10px; font-size: 12px; font-weight: bold; border-radius: 4px; cursor: not-allowed; transition: all 0.2s; }
.history-btn.active { background: #fff; color: #0079bf; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.controls-zone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: bold; color: #4a5568; }
.control-item select { padding: 5px 8px; font-size: 12px; border: 1px solid #cbd5e0; border-radius: 6px; background: #fff; color: #2d3748; cursor: pointer; outline: none; }

.dropdown-menu-wrapper { position: relative; display: inline-block; padding-bottom: 6px; margin-bottom: -6px; }
.dropdown-btn { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e0; padding: 6px 12px; font-size: 12px; font-weight: bold; border-radius: 6px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 4px; }
.dropdown-btn:hover { background: #e2e8f0; }

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: #ffffff;
  min-width: 170px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  z-index: 9999;
  overflow: hidden;
  padding: 4px 0;
}
.dropdown-content button, .dropdown-content label { color: #2d3748; padding: 8px 14px; text-decoration: none; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: none; font-size: 12px; font-weight: 500; cursor: pointer; box-sizing: border-box; }
.dropdown-content button:hover, .dropdown-content label:hover { background-color: #f1f5f9; color: #0079bf; }
.dropdown-menu-wrapper:hover .dropdown-content { display: block; }

.action-btn { border: none; padding: 7px 14px; font-weight: bold; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.action-btn.primary { background: #2ed573; color: white; box-shadow: 0 2px 6px rgba(46,213,115,0.3); }
.action-btn.primary:hover { background: #26af5f; transform: translateY(-1px); }
.action-btn.secondary { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e0; }
.action-btn.secondary:hover { background: #e2e8f0; }

.main-layout { display: flex; flex-direction: column; gap: 20px; }
.daiwari-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.daiwari-grid.rtl-grid { direction: rtl; }
.daiwari-grid.rtl-grid .pair-container { direction: ltr; }

.pair-container { display: flex; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(4px); border: 2px solid #0079bf; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.08); flex-direction: column; position: relative; overflow: hidden; }
.pair-header { background: rgba(244, 245, 247, 0.9); border-bottom: 1px solid #dfe1e6; text-align: center; font-weight: bold; font-size: 12px; color: #0079bf; padding: 4px 0; }

.pair-body { display: flex; min-height: 165px; position: relative; width: 100%; box-sizing: border-box; padding: 6px; gap: 6px; }

.page-box { flex: 1; background: transparent; padding: 0; display: flex; flex-direction: column; align-content: flex-start; gap: 4px; position: relative; box-sizing: border-box; width: 50%; min-height: 145px; z-index: 1; }
.page-box:first-child { border-right: 1px dashed #cbd5e0; padding-right: 6px; }
.page-box:last-child { padding-left: 6px; }
.page-box.drag-over { background: rgba(230, 247, 255, 0.8) !important; border: 2px dashed #0079bf; }

.page-label { width: 100%; font-size: 11px; font-weight: bold; color: #6b778c; border-bottom: 1px solid rgba(244, 245, 247, 0.8); padding-bottom: 2px; margin-bottom: 4px; text-align: center; pointer-events: none; position: relative; z-index: 10; }

.layout-card { background: #fff; border: 1px solid #ced4da; border-radius: 4px; width: 100%; padding: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); font-size: 11px; cursor: grab; user-select: none; box-sizing: border-box; transition: all 0.2s; z-index: 2; position: relative; margin-top: 0; }
.layout-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.15); border-color: #0079bf; }
.layout-card.selected { border: 2px solid #0079bf !important; background: #e6f7ff !important; box-shadow: 0 0 8px rgba(0,121,191,0.4); }
.layout-card:active { cursor: grabbing; }

.layout-card.layout-spread { position: absolute !important; top: 28px !important; left: 6px !important; right: 6px !important; width: calc(100% - 12px) !important; height: auto !important; max-height: none !important; z-index: 100 !important; border: 1px solid #ced4da !important; box-shadow: 0 1px 2px rgba(0,0,0,0.08) !important; background: #ffffff !important; box-sizing: border-box; overflow: visible; padding-bottom: 8px !important; }

.card-thumb-img { width: 100%; max-height: 85px; object-fit: contain; background: #f8f9fa; border-radius: 3px; margin-bottom: 4px; border: 1px solid #eee; display: block; pointer-events: none; }
.card-badges-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.card-badge { display: inline-block; background: #ff9f43; color: #fff; padding: 2px 5px; border-radius: 3px; font-weight: bold; font-size: 10px; }
.card-badge-status { background: #2ed573; }
.card-badge-status.status-校了, .card-badge-status.status-責了 { background: #0079bf; }
.card-badge-status.status-初校, .card-badge-status.status-再校 { background: #eb3b5a; }

.card-title { font-weight: bold; font-size: 11px; word-break: break-all; line-height: 1.3; pointer-events: none; }
.card-footer { margin-top: 4px; font-size: 10px; color: #6b778c; 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 #ced4da; padding: 6px 12px; border-radius: 6px; cursor: grab; font-size: 12px; user-select: none; transition: background 0.15s; }
.sort-item:hover { background: #f0f7ff; border-color: #0079bf; }
.sort-item.dragging { opacity: 0.4; background: #e6f7ff; border: 2px dashed #0079bf; }
.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 #ddd; border-radius: 3px; }
.sort-thumb-empty { width: 32px; height: 32px; background: #eef2f7; border: 1px dashed #cbd5e0; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #a0aec0; }
.sort-page-tag { background: #0079bf; 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 #cbd5e0; padding: 2px 8px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 11px; }
.sort-btn:hover { background: #0079bf; color: white; border-color: #0079bf; }

.collaborator-box { background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(4px); padding: 10px 14px; border-radius: 6px; border: 1px solid #ced4da; }
.member-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.member-tag { background: #e6f7ff; color: #0079bf; font-weight: bold; font-size: 12px; padding: 4px 10px; border-radius: 12px; border: 1px solid #bae7ff; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.member-tag:hover { background: #bae7ff; }
.remove-member-btn { color: #ff4757; border: none; background: none; font-weight: bold; cursor: pointer; font-size: 11px; margin-left: 2px; }
.remove-member-btn:hover { color: #d63031; }

.chat-section { margin-top: 10px; border-top: 1px solid #dfe1e6; padding-top: 10px; }
.chat-thread-box { background: #fafbfc; border: 1px solid #ced4da; 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: #0079bf; margin-bottom: 2px; font-size: 10px; }
.chat-msg-time { color: #a0aec0; font-weight: normal; }
.chat-input-row { display: flex; gap: 6px; }

.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: #0079bf; text-decoration: underline; font-weight: bold; }
.remove-link-btn { color: #ff4757; background: none; border: none; font-weight: bold; cursor: pointer; font-size: 11px; }

.extra-section { display: flex; flex-direction: column; gap: 16px; border-top: 2px dashed #a0aec0; padding-top: 16px; }
.extra-area-title { font-size: 14px; color: #2d3748; margin: 0 0 8px 0; text-shadow: 0 1px 2px rgba(255,255,255,0.8); }

.extra-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; background: rgba(235, 236, 240, 0.88); backdrop-filter: blur(4px); padding: 12px; border-radius: 6px; min-height: 80px; border: 1px solid #ced4da; }
.extra-grid.drag-over { background: rgba(230, 247, 255, 0.9) !important; }
.chushi-grid { background: rgba(255, 235, 230, 0.88); backdrop-filter: blur(4px); border: 2px dashed #ffbdad; }

.modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.65); backdrop-filter: blur(5px); 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: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); border-radius: 12px; width: 1350px; max-width: 98vw; box-shadow: 0 16px 40px rgba(0,0,0,0.35); overflow: hidden; display: flex; flex-direction: column; }
.modal-content.modal-small { background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); border-radius: 8px; width: 520px; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,0.25); overflow: hidden; }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: rgba(244, 245, 247, 0.9); border-bottom: 1px solid #dfe1e6; }
.modal-title-zone { display: flex; align-items: center; gap: 12px; }
.modal-header h3 { margin: 0; font-size: 16px; color: #172b4d; }
.modal-page-badge { background: #0079bf; 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: #6b778c; }

.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: #f4f5f7; border: 2px solid #0079bf; color: #0079bf; width: 46px; height: 46px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; flex-shrink: 0; transition: all 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.nav-arrow-btn:hover { background: #0079bf; color: #fff; transform: scale(1.1); }

.thumbnail-dropzone { flex: 1; border: 2px dashed #0079bf; border-radius: 8px; padding: 6px; text-align: center; cursor: pointer; background: rgba(250, 251, 252, 0.9); transition: background 0.2s; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.thumbnail-dropzone:hover { background: #e6f7ff; }

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

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: bold; color: #42526e; }
.form-group input, .form-group textarea, .form-group select { padding: 8px; border: 1px solid #ced4da; border-radius: 4px; font-size: 12px; }
.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: #e6f7ff; border: 1px solid #bae7ff; color: #0079bf; padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }
.remove-file-btn { color: #ff4757; 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 #ced4da; padding: 10px 14px; text-align: left; border-radius: 6px; font-weight: bold; color: #172b4d; cursor: pointer; transition: all 0.2s; }
.conflict-btn:hover { background: #0079bf; color: #fff; border-color: #0079bf; }

.modal-footer { display: flex; justify-content: space-between; padding: 14px 24px; background: rgba(244, 245, 247, 0.9); border-top: 1px solid #dfe1e6; }
.btn-primary { background: #0079bf; color: #fff; border: none; padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-danger { background: #ff4757; color: #fff; border: none; padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-secondary { background: #e2e8f0; color: #2d3748; border: 1px solid #cbd5e0; padding: 9px 22px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.danger-text { color: #ff4757; background: none; border: none; cursor: pointer; }
