* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  padding: 16px;
  font-size: 13px;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

h1 {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.dev-credit {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  margin-left: 8px;
}

.dev-credit a {
  color: #2563eb;
  text-decoration: underline;
}

.dev-credit a:hover {
  color: #1d4ed8;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.action-btn {
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 6px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: #fafafa;
  border-color: #ccc;
  color: #333;
}


/* 도면 영역 */
.blueprint-container {
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  margin-bottom: 12px;
  overflow: hidden;
}

.blueprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  user-select: none;
}

.blueprint-header:hover {
  background: #f5f5f5;
}

.blueprint-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blueprint-toggle {
  transition: transform 0.2s;
  color: #999;
}

.blueprint-container.collapsed .blueprint-toggle {
  transform: rotate(-90deg);
}

.blueprint-container.collapsed .blueprint-area {
  display: none;
}

.blueprint-container.collapsed .blueprint-header {
  border-bottom: none;
}

.blueprint-title {
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

.blueprint-actions {
  display: flex;
  gap: 4px;
}

.blueprint-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
}

.blueprint-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.blueprint-area {
  position: relative;
  min-height: 200px;
  max-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.blueprint-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #bbb;
  padding: 40px;
}

.blueprint-placeholder svg {
  opacity: 0.5;
}

.blueprint-placeholder p {
  font-size: 13px;
  color: #999;
}

.blueprint-placeholder span {
  font-size: 11px;
  color: #ccc;
}

.blueprint-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.blueprint-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.blueprint-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: move;
  user-select: none;
}

/* 도면 마커 색상 (활성화 색상과 동일, 흰색 글자) */
.blueprint-marker.marker-color-0 { background: #e74c3c; color: white; }
.blueprint-marker.marker-color-1 { background: #3498db; color: white; }
.blueprint-marker.marker-color-2 { background: #2ecc71; color: white; }
.blueprint-marker.marker-color-3 { background: #9b59b6; color: white; }
.blueprint-marker.marker-color-4 { background: #f39c12; color: white; }
.blueprint-marker.marker-color-5 { background: #1abc9c; color: white; }
.blueprint-marker.marker-color-6 { background: #e91e63; color: white; }
.blueprint-marker.marker-color-7 { background: #00bcd4; color: white; }
.blueprint-marker.marker-color-8 { background: #ff5722; color: white; }
.blueprint-marker.marker-color-9 { background: #607d8b; color: white; }

.marker-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-btn:hover {
  opacity: 0.8;
}

.marker-btn.placed {
  opacity: 0.75;
}

/* 마커 색상 - 기본 상태 (흐린 색) */
.marker-color-0 { background: #fde8e6; border: none; color: #e74c3c; }
.marker-color-1 { background: #e3f2fd; border: none; color: #3498db; }
.marker-color-2 { background: #e8f8f0; border: none; color: #2ecc71; }
.marker-color-3 { background: #f3e8f8; border: none; color: #9b59b6; }
.marker-color-4 { background: #fef6e6; border: none; color: #f39c12; }
.marker-color-5 { background: #e6f7f4; border: none; color: #1abc9c; }
.marker-color-6 { background: #fce4ec; border: none; color: #e91e63; }
.marker-color-7 { background: #e0f7fa; border: none; color: #00bcd4; }
.marker-color-8 { background: #fbe9e7; border: none; color: #ff5722; }
.marker-color-9 { background: #eceff1; border: none; color: #607d8b; }

/* 마커 색상 - 활성/배치 상태 (진한 색) */
.marker-color-0.placed, .marker-color-0.active { background: #e74c3c; color: white; }
.marker-color-1.placed, .marker-color-1.active { background: #3498db; color: white; }
.marker-color-2.placed, .marker-color-2.active { background: #2ecc71; color: white; }
.marker-color-3.placed, .marker-color-3.active { background: #9b59b6; color: white; }
.marker-color-4.placed, .marker-color-4.active { background: #f39c12; color: white; }
.marker-color-5.placed, .marker-color-5.active { background: #1abc9c; color: white; }
.marker-color-6.placed, .marker-color-6.active { background: #e91e63; color: white; }
.marker-color-7.placed, .marker-color-7.active { background: #00bcd4; color: white; }
.marker-color-8.placed, .marker-color-8.active { background: #ff5722; color: white; }
.marker-color-9.placed, .marker-color-9.active { background: #607d8b; color: white; }

.blueprint-area.placing {
  cursor: crosshair;
}

.blueprint-area.placing .blueprint-image {
  pointer-events: none;
}

.table-container {
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  overflow-x: auto;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #fafafa;
  font-weight: 500;
  color: #888;
  font-size: 11px;
}

.col-num { width: 32px; text-align: center; }
.col-name { width: 100px; }
.col-length { width: 100px; }
.col-color { width: 70px; }
.col-visual { }
.col-marker { width: 40px; text-align: center; white-space: nowrap; }
.col-action { width: 28px; text-align: center; }

td.col-num {
  text-align: center;
  color: #aaa;
  font-size: 12px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  line-height: 1.4;
}

.name-input,
.length-input {
  width: 80px;
  min-width: 80px;
}

.color-select {
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.color-select:focus {
  outline: none;
  border-color: #aaa;
}

input:focus {
  outline: none;
  border-color: #aaa;
}

input::placeholder {
  color: #ccc;
}

.visual-cell {
  padding: 6px 10px;
  overflow-x: auto;
}

.visual-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.visual-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.visual-bar {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.bar-segment {
  height: 16px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #555;
}

.bar-300 { background: #a8d5ba; width: 24px; }
.bar-400 { background: #a8d5d0; width: 30px; }
.bar-500 { background: #c5d5a8; width: 36px; }
.bar-600 { background: #a8c8e8; width: 40px; }
.bar-900 { background: #f0d8a8; width: 56px; }
.bar-1000 { background: #e8cba8; width: 62px; }
.bar-1200 { background: #d0b8e0; width: 72px; }
.bar-1500 { background: #e8b8c8; width: 88px; }
.bar-power { background: #c8d0d8; width: 28px; font-size: 8px; }

.visual-info {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

.visual-info .power-value {
  color: #555;
  font-weight: 500;
}

.delete-row-btn {
  background: none;
  border: none;
  color: #d0d0d0;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-row-btn:hover {
  color: #e05050;
}

.add-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  width: 28px;
  height: 28px;
  background: white;
  border: 1px dashed #ccc;
  border-radius: 4px;
  color: #999;
  cursor: pointer;
}

.add-row-btn:hover {
  border-color: #999;
  color: #666;
}

/* 발주리스트 */
.order-list {
  margin-top: 16px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.order-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

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

.order-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #666;
  cursor: pointer;
}

.order-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.close-order-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.close-order-btn:hover {
  color: #666;
}

.order-table {
  width: 100%;
  border-collapse: collapse;
}

.order-table th,
.order-table td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.order-table th {
  background: transparent;
  font-size: 11px;
  color: #888;
}

.order-table td {
  font-size: 13px;
}

.order-table .color-header td {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 12px;
  color: #555;
  padding: 6px 14px;
}

.order-table tbody tr:last-child td {
  border-bottom: none;
}

.order-table .size-label {
  font-weight: 500;
}

.order-table .count-value {
  color: #555;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 340px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 12px 14px;
  background: white;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close-btn:hover {
  color: #666;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  background: white;
}

.modal-footer {
  padding: 12px 14px;
  background: #fafafa;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-footer-right {
  display: flex;
  gap: 6px;
}

.setting-group {
  background: #fafafa;
  border-radius: 6px;
  border: 1px solid #eee;
  margin-bottom: 12px;
  overflow: hidden;
}

.setting-group-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  background: transparent;
  border-bottom: 1px solid #eee;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
}

.setting-label {
  font-size: 13px;
  color: #333;
}

.setting-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.setting-input-wrap input {
  width: 70px;
  text-align: right;
}

.setting-unit {
  font-size: 11px;
  color: #999;
}

.setting-hint {
  padding: 0 12px 10px;
  font-size: 10px;
  color: #aaa;
  line-height: 1.4;
}

.size-list-header {
  display: grid;
  grid-template-columns: 1fr 1fr 24px;
  gap: 8px;
  padding: 6px 12px;
  font-size: 10px;
  color: #aaa;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 1fr 24px;
  gap: 8px;
  align-items: center;
  padding: 4px 12px;
  border-top: 1px solid #f0f0f0;
}

.size-row input {
  width: 100%;
  text-align: center;
  padding: 5px 6px;
}

.delete-size-btn {
  background: none;
  border: none;
  color: #d0d0d0;
  cursor: pointer;
  padding: 2px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-size-btn:hover {
  color: #e05050;
}

.add-size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: none;
  border-top: 1px solid #eee;
  color: #888;
  font-size: 11px;
  cursor: pointer;
}

.add-size-btn:hover {
  background: #fafafa;
  color: #555;
}

.btn {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: none;
}

.btn-reset {
  background: none;
  color: #999;
  padding: 6px 0;
}

.btn-reset:hover {
  color: #666;
}

.btn-cancel {
  background: #eee;
  color: #666;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

.btn-apply {
  background: #444;
  color: white;
}

.btn-apply:hover {
  background: #333;
}

.empty-result {
  color: #ccc;
  font-size: 11px;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Footer */
.site-footer {
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid #eee;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-instagram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #f0f0f0;
  border-radius: 50%;
  color: #888;
  transition: all 0.2s;
}

.footer-instagram:hover {
  background: #e0e0e0;
  color: #555;
}

.footer-info {
  font-size: 11px;
  color: #aaa;
}

.footer-divider {
  margin: 0 6px;
  color: #ccc;
}
