.editor-area {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr) !important;
  gap: 24px !important;
}

.chart-container {
  width: 800px;
  height: 400px;
  margin: 0 auto;
  border-radius: 8px;
}

.config-panel {
  max-width: 420px;
}

.config-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 20px;
}

.chart-panel .panel-body {
  flex: 1;
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.light-theme .chart-panel .panel-body {
  background: rgba(0, 0, 0, 0.02);
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-panel #dataEditBtn {
  border-radius: 8px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.light-theme .config-panel #dataEditBtn {
  background: rgba(0, 0, 0, 0.03);
}

.config-panel #dataEditBtn::after {
  content: '+';
  font-size: 16px;
  font-weight: 300;
}

.accordion-item {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
}

.light-theme .accordion-item {
  background: rgba(0, 0, 0, 0.03);
}

.accordion-header {
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: #e5e7eb;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.light-theme .accordion-header {
  color: #1f2937;
}

.accordion-header:hover {
  background: rgba(0, 0, 0, 0.2);
}

.light-theme .accordion-header:hover {
  background: rgba(0, 0, 0, 0.05);
}

.accordion-item .accordion-header::after {
  content: '+';
  font-size: 16px;
  font-weight: 300;
  transition: transform 0.2s;
}

.accordion-item.expanded .accordion-header::after {
  transform: rotate(45deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content > * {
  padding: 0 16px 16px;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 8px !important;
}

.table-controls .secondary {
  font-size: 11px;
  padding: 5px 10px;
}

.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  margin-bottom: 8px;
}

.light-theme .table-container {
  border-color: rgba(0, 0, 0, 0.06);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 280px;
  table-layout: auto;
}

.data-table th,
.data-table td {
  border: 1px solid rgba(148, 163, 184, 0.1);
  padding: 0;
  white-space: nowrap;
}

.light-theme .data-table th,
.light-theme .data-table td {
  border-color: rgba(0, 0, 0, 0.06);
}

.data-table th {
  background: rgba(30, 41, 59, 0.5);
  text-align: center;
}

.light-theme .data-table th {
  background: rgba(0, 0, 0, 0.03);
}

.corner-cell {
  background: rgba(15, 23, 42, 0.8);
  width: 40px;
  min-width: 40px;
  max-width: 40px;
}

.light-theme .corner-cell {
  background: rgba(0, 0, 0, 0.06);
}

.col-header-cell {
  min-width: 60px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 8px;
  user-select: none;
}

.light-theme .col-header-cell {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.04);
}

.header-cell,
.row-label {
  background: rgba(30, 41, 59, 0.4);
}

.light-theme .header-cell,
.light-theme .row-label {
  background: rgba(0, 0, 0, 0.02);
}

.row-label {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  font-weight: 500;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(15, 23, 42, 0.4);
  user-select: none;
}

.light-theme .row-label {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.02);
}

.header-row td {
  background: rgba(30, 41, 59, 0.3);
}

.light-theme .header-row td {
  background: rgba(0, 0, 0, 0.015);
}

.header-input,
.label-input,
.data-input {
  width: 100%;
  min-width: 60px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 13px;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}

.light-theme .header-input,
.light-theme .label-input,
.light-theme .data-input {
  color: #1f2937;
}

.header-input {
  font-weight: 600;
  font-size: 12px;
}

.label-input {
  font-weight: 500;
  text-align: left;
  padding-left: 8px;
}

.data-input {
  font-size: 12px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.header-input:focus,
.label-input:focus,
.data-input:focus {
  background: rgba(16, 185, 129, 0.1);
  border-radius: 4px;
}

.light-theme .header-input:focus,
.light-theme .label-input:focus,
.light-theme .data-input:focus {
  background: rgba(16, 185, 129, 0.06);
}

.table-hint {
  font-size: 11px;
  color: #6b7280;
  padding: 8px 16px !important;
  text-align: center;
}

.light-theme .table-hint {
  color: #9ca3af;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 6px;
}

.light-theme .form-group label {
  color: #6b7280;
}

.form-group .input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: #e5e7eb;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.light-theme .form-group .input {
  background: #ffffff;
  color: #1f2937;
  border-color: #e2e8f0;
}

.form-group .input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.checkbox-group, .radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.checkbox-item, .radio-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #e5e7eb;
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  margin-right: 2px;
  user-select: none;
  transition: all 0.15s ease;
}

.checkbox-item:hover, .radio-item:hover {
  background: rgba(16, 185, 129, 0.12);
}

.light-theme .checkbox-item,
.light-theme .radio-item {
  color: #111827;
}

.light-theme .checkbox-item:hover,
.light-theme .radio-item:hover {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.checkbox-item input[type="checkbox"],
.radio-item input[type="radio"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 2px solid #475569;
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  transition: all 0.2s;
}

.radio-item input[type="radio"] {
  border-radius: 50%;
}

.checkbox-item input[type="checkbox"] {
  border-radius: 4px;
}

.radio-item input[type="radio"]::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: scale(0);
  transition: 0.2s transform cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #10b981;
}

.checkbox-item input[type="checkbox"]::before {
  content: "";
  width: 4px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: 0.2s transform cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-item input[type="checkbox"]:checked,
.radio-item input[type="radio"]:checked {
  border-color: #10b981;
}

.checkbox-item input[type="checkbox"]:checked {
  background: #10b981;
}

.radio-item input[type="radio"]:checked::before {
  transform: scale(1);
}

.checkbox-item input[type="checkbox"]:checked::before {
  transform: rotate(45deg) scale(1);
}

.light-theme .checkbox-item input[type="checkbox"],
.light-theme .radio-item input[type="radio"] {
  border-color: #94a3b8;
}

.data-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.data-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e293b;
  border-radius: 16px 16px 0 0;
  z-index: 1001;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.light-theme .data-modal {
  background: #ffffff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.data-modal.show {
  transform: translateY(0);
}

.data-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.light-theme .data-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.data-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
}

.light-theme .data-modal-title {
  color: #1f2937;
}

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

.data-modal-btns {
  display: flex;
  gap: 6px;
  margin-right: 8px;
}

.data-modal-btns .secondary {
  font-size: 11px;
  padding: 5px 10px;
}

.data-modal-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(148, 163, 184, 0.1);
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}

.data-modal-action-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
}

.light-theme .data-modal-action-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #6b7280;
}

.light-theme .data-modal-action-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #1f2937;
}

.data-modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.light-theme .data-modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
}

.data-modal.maximized {
  max-height: 100vh;
  height: 100vh;
  top: 0;
  border-radius: 0;
}

.data-modal-drag-bar {
  padding: 8px;
  display: flex;
  justify-content: center;
  cursor: grab;
}

.data-modal-drag-bar:active {
  cursor: grabbing;
}

.drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(148, 163, 184, 0.3);
  border-radius: 2px;
}

.light-theme .drag-handle {
  background: rgba(0, 0, 0, 0.15);
}

.data-modal-body {
  flex: 0 1 auto;
  overflow: hidden;
  padding: 12px 16px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.data-modal-body .table-controls {
  margin-bottom: 10px;
}

.data-modal-body .table-container {
  max-height: none;
  margin-bottom: 8px;
  overflow: hidden;
}

.data-modal.maximized .data-modal-body {
  flex: 1;
}

.data-modal.maximized .data-modal-body .table-container {
  max-height: none;
  flex: 1;
}

.data-modal.resized .data-modal-body {
  flex: 1;
}

.data-modal.resized .data-modal-body .table-container {
  flex: 1;
}

.data-modal.resized #spreadsheet {
  height: 100%;
}

.data-table td.selected,
.data-table th.selected,
.data-table .row-label.selected {
  background: rgba(59, 130, 246, 0.3) !important;
  border-color: #3b82f6 !important;
}

.light-theme .data-table td.selected,
.light-theme .data-table th.selected,
.light-theme .data-table .row-label.selected {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: #3b82f6 !important;
}

.data-modal-body .table-hint {
  text-align: center;
}

@media (max-width: 640px) {
  .chart-container {
    width: 100%;
    height: 300px;
  }
  
  .table-container {
    max-height: 180px;
  }
  
  .header-input,
  .label-input,
  .data-input {
    padding: 6px 4px;
    font-size: 11px;
  }
  
  .corner-cell {
    width: 50px;
    min-width: 50px;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .radio-group {
    flex-wrap: wrap;
  }
}

.context-menu {
  position: fixed;
  background: #1e293b;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  min-width: 180px;
  padding: 6px 0;
  border: 1px solid rgba(148, 163, 184, 0.1);
  animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.light-theme .context-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
  transition: background 0.15s ease;
}

.light-theme .context-menu-item {
  color: #374151;
}

.context-menu-item:hover {
  background: rgba(16, 185, 129, 0.15);
}

.light-theme .context-menu-item:hover {
  background: rgba(16, 185, 129, 0.08);
}

.context-menu-item.context-menu-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.light-theme .context-menu-item.context-menu-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.context-menu-icon {
  font-size: 12px;
  width: 16px;
  display: flex;
  justify-content: center;
}

.context-menu-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.1);
  margin: 6px 0;
}

.light-theme .context-menu-divider {
  background: rgba(0, 0, 0, 0.06);
}

.color-picker-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.color-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-picker-item input[type="color"] {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
}

.color-picker-item input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-item input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-picker-label {
  font-size: 10px;
  color: #94a3b8;
}

.light-theme .color-picker-label {
  color: #6b7280;
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.light-theme .form-select {
  color: #1f2937;
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.form-select:focus {
  border-color: #10b981;
}

.light-theme .form-select:focus {
  border-color: #3b82f6;
}

.form-select option {
  background: #1e293b;
  color: #e5e7eb;
}

.light-theme .form-select option {
  background: #ffffff;
  color: #1f2937;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-input-row input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-input-row .input {
  flex: 1;
  font-family: monospace;
  font-size: 12px;
}

.series-color-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.color-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-index {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
  flex-shrink: 0;
}

.light-theme .color-index {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.04);
}

.color-picker-input {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-text-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-family: monospace;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.light-theme .color-text-input {
  color: #1f2937;
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.color-text-input:focus {
  border-color: #10b981;
}

.light-theme .color-text-input:focus {
  border-color: #3b82f6;
}

.reset-colors-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.light-theme .reset-colors-btn {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.reset-colors-btn:hover {
  color: #e5e7eb;
  background: rgba(148, 163, 184, 0.2);
}

.light-theme .reset-colors-btn:hover {
  color: #1f2937;
  background: rgba(0, 0, 0, 0.04);
}

.opacity-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opacity-slider-wrap input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.opacity-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #10b981;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}

.light-theme .opacity-slider-wrap input[type="range"]::-webkit-slider-thumb {
  background: #3b82f6;
}

.opacity-slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.opacity-value {
  font-size: 12px;
  color: #94a3b8;
  min-width: 36px;
  text-align: right;
  font-family: monospace;
}

.light-theme .opacity-value {
  color: #6b7280;
}

.form-row-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  display: block;
}

.light-theme .form-row-label {
  color: #6b7280;
}

.jexcel {
  border-radius: 8px;
  overflow: hidden;
}
.jexcel table {
  font-family: inherit;
}
.jexcel thead > tr > td {
  font-weight: 600;
}
.jexcel > tbody > tr > td:first-child,
.jexcel > thead > tr > td:first-child {
  width: 50px !important;
  text-align: center;
}
.light-theme .jexcel {
  background-color: #ffffff;
  color: #313533;
}
.light-theme .jexcel thead > tr > td {
  background-color: #edf3ff;
  color: #313533;
  border-bottom: 1px solid #d6e4ff;
  font-weight: 500;
}
.light-theme .jexcel > tbody > tr > td:first-child {
  background-color: #edf3ff;
  color: #313533;
  border-right: 1px solid #d6e4ff;
}
.light-theme .jexcel td {
  border-color: #e5edf7;
}
.light-theme .jexcel .jexcel_cursor {
  border-color: #3b82f6;
}
.light-theme .jexcel .highlight {
  background-color: #dbeafe !important;
}
.light-theme .jexcel .jexcel_selectall {
  background-color: #edf3ff;
}
.dark-theme .jexcel {
  background-color: #1e293b;
  color: #e2e8f0;
}
.dark-theme .jexcel thead > tr > td {
  background-color: #334155;
  color: #cbd5e1;
  border-bottom: 2px solid #475569;
}
.dark-theme .jexcel > tbody > tr > td:first-child {
  background-color: #273449;
  color: #94a3b8;
  border-right: 1px solid #475569;
}
.dark-theme .jexcel td {
  border-color: #334155;
}
.dark-theme .jexcel .jexcel_cursor {
  border-color: #60a5fa;
}
.dark-theme .jexcel .highlight {
  background-color: #1e3a5f !important;
}
.dark-theme .jexcel input,
.dark-theme .jexcel textarea {
  background-color: #0f172a;
  color: #e2e8f0;
  border-color: #475569;
}
.jexcel_content {
  overflow-x: auto;
}
#spreadsheet {
  width: 100%;
}

.data-modal.maximized #spreadsheet {
  height: 100%;
}

#spreadsheet .jexcel_content {
  overflow: auto;
}