#default-subtitle {
  font-size: 0.85rem;
  color: #666;
  display: block;
  margin-bottom: 10px;
}

.hidden-section {
  display: none;
}

.visible-section {
  display: block;
}

:root {
  --td-width: 180px;
  --td-height: 90px;
  --sidebar-width: 280px;
  --primary-color: #28a745;
  --bg-light: #f8f9fa;
  --border-color: #dee2e6;
}

body {
  margin: 0;
  display: flex; /* 사이드바와 메인 영역 가로 배치 */
  height: 100vh;
  overflow: hidden;
  font-family:
    "Pretendard",
    -apple-system,
    sans-serif;
  background-color: #fff;
}

/* 사이드바 스타일 */
.side-panel {
  width: var(--sidebar-width);
  background-color: var(--bg-light);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  height: 100vh;
  box-sizing: border-box;
}
.left {
  border-right: 1px solid var(--border-color);
}
.right {
  border-left: 1px solid var(--border-color);
}

#sidebar h2 {
  font-size: 1.1rem;
  margin: 0 0 10px 0;
  color: #333;
}

.sidebar-section {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 5px;
}

#action-sidebar {
  display: none;
}

/* 메인 콘텐츠 영역 */
#main-content {
  flex: 1;
  padding: 30px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  display: flex;
  justify-content: flex-start;
}

table {
  border: 3px solid #333;
  border-collapse: collapse;
  background-color: white;
}

td {
  min-width: var(--td-width);
  max-width: var(--td-width);
  width: var(--td-width);
  height: var(--td-height);
  border: 1px solid #999;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
  font-weight: 500;
  transition: all 0.2s;
}

.cell-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  gap: 0px;
  overflow: hidden;
}

.name-text {
  display: block;
  min-height: 1.2em;
  margin-bottom: 5px;
  font-size: inherit;
  word-break: break-all;
}

/* 버튼 공통 스타일 */
button {
  width: 100%;
  padding: 10px 15px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

button:hover {
  background-color: #f0f0f0;
  border-color: var(--primary-color);
}

button i {
  width: 18px;
  color: var(--primary-color);
}

#btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  font-weight: bold;
}

#btn:hover {
  background-color: #218838;
  transition: 0.3s;
}

.active-mode {
  background-color: #e9ecef !important;
  border-left: 4px solid var(--primary-color) !important;
  font-weight: bold;
}

/* 모드별 시각적 효과 */
.mode_change_onclick {
  border: 3px solid #4a90e2 !important;
  background-color: #ebf3ff;
}

.mode_change_onmouse {
  border: 3px dashed #4a90e2 !important;
}

td {
  position: relative;
}

.mode_anchor_onclick {
  position: relative;
}

.mode_anchor_onclick::after {
  content: "🔒";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background-color: rgba(231, 76, 60, 0.9);
  color: #ffffff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

body.anchor-marker-hidden .mode_anchor_onclick::after {
  display: none;
}

body.capture-anchor-marker-hidden .mode_anchor_onclick::after {
  display: none !important;
}

body.capture-anchor-marker-visible .mode_anchor_onclick::after {
  display: block !important;
}

.mode_anchor_onmouse {
  outline: 3px dashed #e74c3c;
  outline-offset: -4px;
  cursor: pointer;
}

.assign-section-card {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.assign-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #333;
}

.assign-section-title i {
  color: var(--primary-color);
}

.assign-mode-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px 0;
  padding: 8px;
  border-radius: 8px;
  background-color: #f8f9fa;
}

.assign-mode-wrapper label {
  padding: 8px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: #ffffff;
}

.assign-mode-wrapper label:has(input:checked) {
  border-color: var(--primary-color);
  background-color: #eefaf1;
  font-weight: 700;
}

.assign-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin: 8px 0 10px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
}

.assign-name-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.assign-selected-cell-row,
.assign-selected-count-row {
  padding: 8px 10px;
  margin: 6px 0 8px 0;
  border-radius: 6px;
  background-color: #f8f9fa;
  font-size: 0.85rem;
  color: #555;
}

#assignMoveNextLabel,
#AssignAnchorlabel,
#assignMoveDesignWithSeatLabel {
  padding: 8px 10px;
  margin: 8px 0;
  border-radius: 6px;
  background-color: #f8f9fa;
}

.assign-primary-btn {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
}

.assign-primary-btn i {
  color: #ffffff;
}

.assign-primary-btn:hover {
  background-color: #218838;
  border-color: #218838;
}

.assign-secondary-btn {
  background-color: #ffffff;
}

.assign-danger-btn {
  border-color: #e74c3c;
  color: #e74c3c;
}

.assign-danger-btn i {
  color: #e74c3c;
}

.assign-danger-btn:hover {
  background-color: #fff5f5;
  border-color: #e74c3c;
}

.assign-exchange-card {
  border-color: #cfe2ff;
  background-color: #f8fbff;
}

.assign-exchange-toggle-btn {
  border-color: #4a90e2;
  color: #4a90e2;
  font-weight: 700;
}

.assign-exchange-toggle-btn i {
  color: #4a90e2;
}

.assign-exchange-toggle-btn:hover {
  background-color: #eef7ff;
  border-color: #4a90e2;
}

.assign-exchange-toggle-btn.assign-exchange-active {
  background-color: #4a90e2;
  border-color: #4a90e2;
  color: #ffffff;
}

.assign-exchange-toggle-btn.assign-exchange-active i {
  color: #ffffff;
}

.mode_assign_onmouse {
  outline: 3px dashed #3498db;
  outline-offset: -3px;
  background-color: #eef7ff !important;
  cursor: pointer;
}

.mode_assign_selected {
  outline: 3px solid #3498db;
  outline-offset: -3px;
  background-color: #dff0ff !important;
}

.mode_assign_multi_selected {
  outline: 3px solid #2ecc71;
  outline-offset: -3px;
  background-color: #e7fff0 !important;
}

.assign_input[type="text"] {
  width: 80%;
  height: 20%;
  padding: 6px;
  border: 1px solid #050505;
  border-radius: 4px;
  outline: none;
  font-size: 0.9rem;
  box-sizing: border-box;
  text-align: center;
}

label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 0;
}

.mode_design_selected {
  outline: 3px solid #9b59b6;
  outline-offset: -3px;
  background-color: #f5e8ff !important;
}

.design-toolbar {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px 0;
}

.design-toggle-btn {
  width: 38px;
  height: 34px;
  padding: 0;
  margin: 0;
  justify-content: center;
  font-weight: bold;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
}

.design-toggle-btn.active {
  background-color: #e9ecef;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.design-toggle-btn[data-style="italic"] {
  font-style: italic;
}

.design-toggle-btn[data-style="underline"] {
  text-decoration: underline;
}

.design-toggle-btn[data-style="strike"] {
  text-decoration: line-through;
}

.mode_design_single_selected {
  outline: 3px solid #22a06b;
  outline-offset: -3px;
  background-color: #eafaf2 !important;
}

.design-mode-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px 0;
  padding: 8px;
  border-radius: 8px;
  background-color: #f8f9fa;
}

.design-mode-wrapper label {
  padding: 8px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: #ffffff;
}

.design-mode-wrapper label:has(input:checked) {
  border-color: var(--primary-color);
  background-color: #eefaf1;
  font-weight: 700;
}

.design-section-title {
  margin: 10px 0 6px 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #333333;
}

.mode_design_single_selected {
  outline: 3px solid #22a06b;
  outline-offset: -3px;
  background-color: #eafaf2 !important;
}

.mode_design_onmouse {
  background-image:
    linear-gradient(#22a06b, #22a06b), linear-gradient(#22a06b, #22a06b),
    linear-gradient(#22a06b, #22a06b), linear-gradient(#22a06b, #22a06b),
    linear-gradient(#22a06b, #22a06b), linear-gradient(#22a06b, #22a06b),
    linear-gradient(#22a06b, #22a06b), linear-gradient(#22a06b, #22a06b);
  background-repeat: no-repeat;
  background-size:
    18px 3px,
    3px 18px,
    18px 3px,
    3px 18px,
    18px 3px,
    3px 18px,
    18px 3px,
    3px 18px;
  background-position:
    left top,
    left top,
    right top,
    right top,
    left bottom,
    left bottom,
    right bottom,
    right bottom;
  cursor: pointer;
}

.font-size-control-row {
  margin: 8px 0 12px 0;
}

.font-size-control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: bold;
}

.font-size-control-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-size-control-inputs input[type="range"] {
  flex: 1;
}

.font-size-control-inputs input[type="number"] {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.8rem;
  text-align: right;
  box-sizing: border-box;
}

.palette-color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px 0;
}

.palette-color-chip {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  box-sizing: border-box;
}

.palette-color-chip.active {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

.oklch-control-row {
  margin: 8px 0 12px 0;
}

.oklch-control-group {
  margin-bottom: 8px;
}

.oklch-control-group label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.oklch-control-group input[type="range"] {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

/* Chrome / Edge / Safari */
.oklch-control-group input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.oklch-control-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Firefox */
.oklch-control-group input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.oklch-control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

[id$="-delete-custom-color-btn"] {
  background-color: #dc3545;
  color: #ffffff;
  border: none;
  font-weight: bold;
}

[id$="-delete-custom-color-btn"] i {
  color: #ffffff;
}

[id$="-delete-custom-color-btn"]:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

[id$="-delete-custom-color-btn"]:disabled {
  background-color: #e9a1a8;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 0.7;
}

.rgb-control-row {
  margin: 8px 0 12px 0;
}

.rgb-control-group {
  margin-bottom: 8px;
}

.rgb-control-group label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.rgb-control-group input[type="range"] {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.rgb-control-group input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.rgb-control-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.rgb-control-group input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.rgb-control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.color-control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.color-number-input {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.8rem;
  text-align: right;
  box-sizing: border-box;
}

.color-number-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

#action-sidebar.color-settings-open {
  width: 920px;
  max-width: 920px;
}

.color-settings-screen {
  width: 100%;
}

#back-to-design-btn {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  font-weight: 600;
}

#back-to-design-btn:hover {
  background-color: #f0f0f0;
  border-color: var(--primary-color);
}

.cell-design-preview-section {
  margin: 10px 0 16px 0;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: #ffffff;
}

.cell-design-preview-title {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 8px;
  color: #333333;
}

.cell-design-preview-box {
  width: 180px;
  height: 90px;
  margin: 0 auto;
  border: 2px solid #808080;
  border-radius: 6px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
  transition:
    color 0.15s,
    background-color 0.15s,
    border-color 0.15s;
}

.color-target-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  min-width: 820px;
}

.color-target-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  background-color: #f8f9fa;
}

.color-target-card h4 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
}

.color-target-preview {
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin: 8px 0;
  padding: 8px;
  font-size: 0.75rem;
  text-align: center;
  word-break: break-all;
}

.color-target-action-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.color-target-action-row button {
  flex: 1;
  justify-content: center;
  font-size: 0.78rem;
  padding: 8px;
}

.color-target-action-row button.unsupported {
  background-color: #e9ecef;
  color: #777777;
  border-color: #ced4da;
  cursor: not-allowed;
  opacity: 0.75;
}

.color-target-action-row button.unsupported i {
  color: #777777;
}

.color-target-action-row button.unsupported:hover {
  background-color: #e9ecef;
  border-color: #ced4da;
}

.modify-section-title {
  margin: 14px 0 8px 0;
  font-size: 0.95rem;
  font-weight: bold;
  color: #333333;
}

.modify-control-card {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.modify-control-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
}

.modify-control-card-title i {
  color: var(--primary-color);
}

.modify-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modify-compact-btn {
  min-height: 42px;
  margin-bottom: 0;
  padding: 8px 10px;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.modify-compact-btn i {
  width: auto;
}

.modify-compact-btn.add {
  border-color: #bfe8c9;
  background-color: #f3fff6;
}

.modify-compact-btn.add i {
  color: var(--primary-color);
}

.modify-compact-btn.delete {
  border-color: #f1c6c1;
  background-color: #fff7f6;
  color: #c0392b;
}

.modify-compact-btn.delete i {
  color: #c0392b;
}

.modify-compact-btn.add:hover {
  background-color: #e8f8ed;
  border-color: var(--primary-color);
}

.modify-compact-btn.delete:hover {
  background-color: #fff0ef;
  border-color: #e74c3c;
}

.modify-mode-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px 0;
  padding: 8px;
  border-radius: 8px;
  background-color: #f8f9fa;
}

.modify-mode-wrapper label {
  padding: 8px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: #ffffff;
}

.modify-mode-wrapper label:has(input:checked) {
  border-color: var(--primary-color);
  background-color: #eefaf1;
  font-weight: 700;
}

.modify-selected-cell-row {
  padding: 8px 10px;
  margin: 8px 0 10px 0;
  border-radius: 6px;
  background-color: #fff8e6;
  font-size: 0.85rem;
  color: #555;
}

.mode_modify_onmouse {
  outline: 3px dashed #f39c12;
  outline-offset: -3px;
  background-color: #fffaf0 !important;
  cursor: pointer;
}

.mode_modify_selected {
  outline: 3px solid #f39c12;
  outline-offset: -3px;
  background-color: #fff3cd !important;
}

.table-size-control-row {
  margin: 10px 0 14px 0;
}

.table-size-control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: bold;
}

.table-size-control-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-size-control-inputs input[type="range"] {
  flex: 1;
}

.table-size-control-inputs input[type="number"] {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.8rem;
  text-align: right;
  box-sizing: border-box;
}

.alignment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 12px 0;
}

.alignment-btn {
  height: 74px;
  padding: 6px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  box-sizing: border-box;
}

.alignment-btn:hover {
  border-color: var(--primary-color);
  background-color: #f8f9fa;
}

.alignment-btn.active {
  background-color: #f1e8ff;
  border-color: #8a3ffc;
  box-shadow: 0 0 0 2px rgba(138, 63, 252, 0.18);
}

.alignment-preview-cell {
  width: 46px;
  height: 30px;
  padding: 3px;
  display: flex;
  border: 1px solid #777777;
  background-color: #ffffff;
  box-sizing: border-box;
}

.alignment-preview-text {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #333333;
  line-height: 1;
}

.alignment-btn.active .alignment-preview-cell {
  border-color: #8a3ffc;
  background-color: #ffffff;
}

.alignment-btn.active .alignment-preview-text {
  color: #8a3ffc;
}

.alignment-btn-label {
  font-size: 0.68rem;
  line-height: 1.1;
  color: #333333;
  white-space: nowrap;
}

.alignment-btn.active .alignment-btn-label {
  color: #6f2bd9;
  font-weight: 700;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:disabled:hover {
  background-color: white;
  border-color: var(--border-color);
}

.setting-option-wrapper {
  margin-bottom: 15px;
}

.setting-option-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.setting-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.setting-help-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.setting-help-button {
  width: 18px !important;
  min-width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: #666;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.setting-help-button:hover {
  background-color: #f0f0f0;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.setting-help-tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  max-width: calc(100vw - 40px);
  padding: 8px 10px;
  border-radius: 6px;
  background-color: #333;
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  word-break: keep-all;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 9999;
}

.setting-help-tooltip::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #333 transparent;
}

.setting-help-wrapper:hover .setting-help-tooltip,
.setting-help-wrapper:focus-within .setting-help-tooltip {
  opacity: 1;
  visibility: visible;
}

.setting-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #333333;
}

.setting-section-title i {
  color: var(--primary-color);
}

.setting-limit-help-text {
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  background-color: #f8f9fa;
  color: #666666;
  font-size: 0.8rem;
  line-height: 1.4;
}

.setting-number-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
}

.setting-number-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333333;
}

.setting-number-row input[type="number"] {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: right;
  box-sizing: border-box;
}

.setting-number-row input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.setting-checkbox-group-wrapper {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: #ffffff;
}

.setting-checkbox-group-wrapper .setting-section-title {
  margin-top: 0;
}

.setting-checkbox-group-wrapper .setting-option-row {
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.setting-checkbox-group-wrapper .setting-option-row:last-child {
  border-bottom: none;
}

.setting-checkbox-group-wrapper .setting-checkbox-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.setting-checkbox-group-wrapper .setting-help-wrapper {
  flex: 0 0 auto;
}

.table-size-sub-title {
  margin: 12px 0 8px 0;
  padding: 6px 8px;
  border-radius: 6px;
  background-color: #f8f9fa;
  font-size: 0.85rem;
  font-weight: 700;
  color: #333333;
}

.table-size-select-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px 0;
}

.table-size-select-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333333;
}

.table-size-select-row select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: #ffffff;
}

.table-size-select-row select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.table-size-mode-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 12px 0;
  padding: 8px;
  border-radius: 8px;
  background-color: #f8f9fa;
}

.table-size-mode-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: #ffffff;
  cursor: pointer;
}

.table-size-mode-label:has(input:checked) {
  border-color: var(--primary-color);
  background-color: #eefaf1;
  font-weight: 700;
}

.table-size-help-text {
  margin: 8px 0 10px 0;
  padding: 8px 10px;
  border-left: 4px solid var(--primary-color);
  border-radius: 6px;
  background-color: #f8f9fa;
  color: #555555;
  font-size: 0.82rem;
  line-height: 1.45;
}

.view-search-guide {
  margin: 8px 0 12px 0;
  padding: 8px 10px;
  border-left: 4px solid var(--primary-color);
  border-radius: 6px;
  background-color: #f8f9fa;
  color: #555555;
  font-size: 0.85rem;
  line-height: 1.45;
}

.view-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin: 8px 0 10px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
}

.view-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.view-search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #ffffff;
  font-size: 0.9rem;
}

.view-search-move-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.view_search_hit {
  outline: 3px solid #f1c40f !important;
  outline-offset: -4px;
}

.view_search_active {
  outline: 4px solid #e67e22 !important;
  outline-offset: -5px;
  box-shadow: inset 0 0 0 9999px rgba(241, 196, 15, 0.18);
}

/* ================================
   Print Preview / Print CSS
================================ */

body.print-preview-mode {
  overflow: auto;
  background-color: #ffffff;
}

body.print-preview-mode #sidebar,
body.print-preview-mode #action-sidebar {
  display: none !important;
}

body.print-preview-mode #main-content {
  width: 100vw;
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
  justify-content: center;
  align-items: flex-start;
}

body.print-preview-mode .table-container {
  justify-content: center;
  overflow: visible;
}

body.print-preview-mode table {
  margin: 0 auto;
  box-shadow: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  html,
  body {
    width: auto;
    height: auto;
    overflow: visible !important;
    background: #ffffff !important;
  }

  #sidebar,
  #action-sidebar {
    display: none !important;
  }

  #main-content {
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .table-container {
    width: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  table {
    margin: 0 auto !important;
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: none !important;
  }

  td {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  button,
  input,
  textarea,
  select {
    display: none !important;
  }

  .view_search_hit,
  .view_search_active,
  .mode_assign_selected,
  .mode_modify_selected,
  .mode_design_selected {
    outline: none !important;
    box-shadow: none !important;
  }
}

.print-preview-floating-toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  display: none;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dddddd;
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.print-preview-floating-toolbar button {
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.print-preview-floating-toolbar button:hover {
  filter: brightness(0.95);
}

@media print {
  .print-preview-floating-toolbar {
    display: none !important;
  }
}

/* PDF / Print width fitting */
body.print-fit-width table {
  zoom: var(--print-table-scale, 1);
}

@media print {
  body.print-fit-width table {
    zoom: var(--print-table-scale, 1) !important;
  }
}

.table-gap-spacer-cell,
.table-gap-row-spacer-cell {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  pointer-events: none !important;
}

.table-gap-spacer-row {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  pointer-events: none !important;
}

.individual-gap-setting-wrapper {
  margin-top: 16px;
}

.setting-sub-section-title {
  margin: 14px 0 8px 0;
  padding: 7px 9px;
  border-left: 4px solid var(--primary-color);
  border-radius: 6px;
  background-color: #f8f9fa;
  font-weight: 700;
  font-size: 0.9rem;
}

.individual-gap-row label {
  font-size: 0.85rem;
}

.help-card {
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.help-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #333333;
}

.help-card-title i {
  color: var(--primary-color);
}

.help-card-text {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #666666;
}

.help-email-link {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 6px;
  background-color: #eefaf1;
  color: #1f7a3a;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}

.help-email-link:hover {
  text-decoration: underline;
}
