:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f8fafc;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.72);
  --border: rgba(15, 23, 42, 0.12);
  --accent: #2563eb;
  --danger: #dc2626;
  --good: #16a34a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: #ffffff;
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.title {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  padding: 14px;
  align-items: start;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.panel-left {
}

.panel-right {
}

.section {
  margin-bottom: 14px;
}

.section:last-child {
  margin-bottom: 0;
}

.section-title {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 700;
}

.subsection {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(15, 23, 42, 0.14);
}

.subsection-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.row-tight {
  margin-bottom: 8px;
}

.row-between {
  justify-content: space-between;
  margin-bottom: 0;
}

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

.grid-item {
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
}

.grid-item.axis .axis-manual {
  margin-top: 10px;
}

.label {
  font-size: 12px;
  color: var(--muted);
  min-width: 60px;
}

.hint {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
  line-height: 1.35;
}

.error {
  font-size: 12px;
  color: rgba(220, 38, 38, 0.95);
  margin-top: 6px;
  min-height: 16px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.10);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.16);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.18);
}

.btn-danger {
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(220, 38, 38, 0.10);
}

.btn-small {
  padding: 6px 8px;
  border-radius: 9px;
  font-weight: 600;
}

.checkbox,
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

input.input {
  width: 100%;
}

.input {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
  font-size: 13px;
}

.input:focus {
  border-color: rgba(37, 99, 235, 0.9);
}

.input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.input.small {
  max-width: 110px;
}

.select {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
  font-size: 13px;
}

.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  font-size: 13px;
  resize: vertical;
}

.table-wrap {
  margin-top: 6px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 340px;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 8px 8px;
  text-align: left;
  font-size: 13px;
}

.table th {
  color: rgba(15, 23, 42, 0.78);
  font-weight: 700;
  background: rgba(15, 23, 42, 0.04);
}

.th-index {
  width: 44px;
}

.th-actions {
  width: 82px;
}

.table input {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.16);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.table input:focus {
  border-color: rgba(37, 99, 235, 0.9);
}

.plot-wrap {
  width: 100%;
  height: 560px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(1200px 700px at 30% 10%, rgba(37, 99, 235, 0.10), transparent 40%),
    rgba(248, 250, 252, 0.95);
}

.axis-title-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

.axis-title-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticks-xy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ticks-xy-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 980px) {
  .ticks-xy-grid {
    grid-template-columns: 1fr;
  }
  .axis-title-grid {
    grid-template-columns: 1fr;
  }
}

canvas#plotCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.export-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.export-hint {
  font-size: 13px;
  color: rgba(15, 23, 42, 0.6);
}

.toast {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(15, 23, 42, 0.9);
  min-height: 18px;
}

