:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #687083;
  --soft: #f8fafc;
  --line: #dce3ec;
  --blue: #2368d9;
  --green: #15845b;
  --amber: #b7791f;
  --red: #c73535;
  --shadow: 0 14px 32px rgba(24, 32, 51, 0.07);
  --shadow-soft: 0 6px 18px rgba(24, 32, 51, 0.05);
  --sidebar-width: 320px;
  --chart-height: 500px;
  --table-height: 320px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 18px 28px;
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h3 {
  font-size: 14px;
  margin: 16px 0 8px;
  color: var(--muted);
}

.topbar p,
.chart-head p {
  color: #8b95a7;
  margin-top: 5px;
  font-size: 13px;
}

.topbar p {
  color: #c7cedb;
}

.topbar-title {
  min-width: 220px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

main {
  padding: 20px 22px 28px;
}

button,
select,
input,
textarea {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 104, 217, 0.12);
  outline: 0;
}

textarea {
  min-height: 76px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.4;
}

button {
  padding: 0 14px;
  background: #f3f6fa;
  color: var(--ink);
  cursor: pointer;
  border-color: #cdd8e8;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

button:hover {
  border-color: var(--blue);
  background: #eaf1fb;
}

button.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

button.primary:hover {
  background: #1d5bc2;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
  opacity: 0.58;
  transform: none;
}

.topbar-actions button {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.topbar-actions button:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.16);
}

.topbar-actions button.primary {
  border-color: #2f7be8;
  background: #2f7be8;
}

.workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.workspace.controls-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.controls-collapsed .controls,
.workspace.controls-collapsed .resize-handle-vertical {
  display: none;
}

.side-toggle {
  height: 32px;
  margin: 0 0 10px;
  padding: 0 12px;
  font-size: 13px;
  border-color: #cfd8e5;
  background: #fff;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.resize-handle {
  border-radius: 999px;
  background: transparent;
  transition: background 0.16s ease;
}

.resize-handle:hover,
.is-resizing-layout .resize-handle {
  background: #c7d3e2;
}

.resize-handle-vertical {
  position: sticky;
  top: 102px;
  height: calc(100vh - 124px);
  cursor: col-resize;
}

.resize-handle-horizontal {
  height: 8px;
  cursor: row-resize;
}

.is-resizing-layout {
  cursor: grabbing;
  user-select: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #d9e2ee;
  border-radius: 999px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 12px;
}

.controls {
  position: sticky;
  top: 102px;
  max-height: calc(100vh - 124px);
  overflow: auto;
  scrollbar-width: thin;
}

.controls form {
  display: grid;
  gap: 9px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}

.controls h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -16px -16px 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.controls > form:last-of-type,
.side-details:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.side-details {
  border-bottom: 1px solid var(--line);
  padding: 2px 0 12px;
}

.side-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  padding: 12px 0 6px;
}

.side-details summary:hover {
  color: var(--blue);
}

.compact-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.compact-details summary {
  padding: 10px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.side-details form {
  margin-top: 6px;
}

.side-details form:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.live-refresh-actions {
  margin: 8px 0 2px;
}

.live-refresh-actions button {
  width: 100%;
  height: 36px;
  font-size: 13px;
  font-weight: 700;
}

.field-line {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.field-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.field-line input,
.field-line select,
.field-line textarea {
  min-width: 0;
}

.select-add-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.segmented-control label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control label:has(input:checked) {
  border-color: #9fc3ff;
  background: #eef5ff;
  color: var(--blue);
}

.segmented-control input {
  width: auto;
  height: auto;
  margin: 0;
}

.inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.active-paste-groups {
  display: grid;
  gap: 10px;
}

.active-paste-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.active-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px auto 54px;
  gap: 7px;
  align-items: center;
}

.active-group-name {
  min-width: 0;
}

.active-group-color {
  width: 38px;
  padding: 3px;
}

.active-paste-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.active-paste-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.active-paste-grid textarea {
  min-height: 112px;
  font-family: Consolas, "Segoe UI", monospace;
  line-height: 1.45;
}

.active-group-status {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.mini-btn {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.hint-block,
.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hint-block {
  margin: 4px 0 10px;
  padding: 9px 10px;
  border: 1px solid #d7e0ec;
  border-radius: 6px;
  background: #f8fbff;
}

.field-note {
  margin-top: -4px;
}

.import-preview {
  min-height: 34px;
  padding: 9px 10px;
  border: 1px dashed #cfd8e5;
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.preview-line {
  margin-top: 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.preview-error {
  margin-top: 4px;
  color: var(--red);
}

.preview-warn {
  margin-top: 4px;
  color: var(--amber);
}

.cell-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.conflict-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #f1c46b;
  border-radius: 6px;
  background: #fff8e7;
  color: #5f430b;
  font-size: 13px;
}

.conflict-banner strong,
.conflict-banner span {
  display: block;
}

.conflict-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.conflict-actions button {
  height: 32px;
  white-space: nowrap;
}

.point-editor input[type="number"] {
  height: 34px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.check input {
  width: 16px;
  height: 16px;
}

.content {
  display: grid;
  gap: 8px;
}

.chart-board {
  display: grid;
  gap: 8px;
}

.chart-board.has-compare {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.chart-board.has-compare .main-chart-card {
  min-height: 100%;
}

.compare-charts {
  display: contents;
}

.chart-card {
  min-width: 0;
}

.chart-panel {
  min-width: 0;
  padding: 18px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.chart-head p {
  color: var(--muted);
}

.chart-tools {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 34px 34px;
  gap: 8px;
  align-items: center;
  width: min(280px, 100%);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.compare-chart-panel .chart-tools {
  grid-template-columns: minmax(132px, 1fr) 34px 34px;
}

.compare-chart-panel h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-chart-panel .chart-canvas-wrap canvas {
  height: min(var(--chart-height), 430px);
}

.chart-drop-zone {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px dashed #9eb7db;
  border-radius: 8px;
  background: #eef5ff;
  color: #1d5bc2;
  font-size: 13px;
  font-weight: 700;
}

.chart-drop-zone.drag-over {
  border-color: var(--blue);
  background: #dfeeff;
}

.chart-drag-ghost {
  position: fixed;
  z-index: 80;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid #9eb7db;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.compare-drop-target {
  outline: 2px solid rgba(35, 104, 217, 0.36);
  outline-offset: 2px;
}

.chart-filters {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #fbfcfe;
}

.chart-filters[hidden] {
  display: none;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-row strong {
  min-width: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.filter-check:hover {
  border-color: #b8c8dc;
}

.filter-check:has(input:checked) {
  border-color: #b9d1f5;
  background: #edf5ff;
}

.filter-check input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.filter-check input[type="color"] {
  width: 24px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.filter-check .marker-color {
  margin-left: 2px;
}

.range-row {
  row-gap: 6px;
}

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

.axis-fit-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #edf6f2;
  color: var(--green);
  font-size: 12px;
}

.axis-range-hint {
  color: var(--muted);
  font-size: 12px;
}

.mini-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.mini-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.filter-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0;
}

.filter-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
}

.filter-details[open] {
  padding-bottom: 8px;
}

.filter-details[open] summary {
  margin-bottom: 6px;
}

.filter-details .filter-row {
  padding: 0 10px 8px;
}

.active-style-stack {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.active-style-stack > strong {
  color: var(--muted);
  font-size: 12px;
}

.active-style-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 34px 80px 64px 72px 64px auto;
  gap: 7px;
  align-items: center;
  padding: 7px;
  border: 1px solid #e5ebf3;
  border-radius: 6px;
  background: #fbfcfe;
}

.active-style-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.active-style-row input,
.active-style-row select {
  height: 30px;
  min-width: 0;
  padding: 0 6px;
  font-size: 12px;
}

.active-style-row input[type="color"] {
  width: 34px;
  padding: 2px;
}

.compact-check {
  min-width: 54px;
  font-size: 12px;
}

.chart-canvas-wrap {
  position: relative;
  overflow: auto hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

canvas {
  display: block;
  width: 100%;
  height: var(--chart-height);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  width: min(330px, calc(100% - 16px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(24, 32, 51, 0.16);
  pointer-events: none;
  font-size: 12px;
}

.chart-tooltip[hidden] {
  display: none;
}

.marker-editor {
  position: absolute;
  z-index: 6;
  width: 240px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(24, 32, 51, 0.18);
}

.marker-editor[hidden] {
  display: none;
}

.marker-editor-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.marker-editor-sub {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.marker-editor input:not([type="color"]) {
  height: 32px;
  margin-bottom: 8px;
}

.marker-editor-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.marker-editor-actions input[type="color"] {
  width: 42px;
  padding: 2px;
}

.marker-editor-actions button {
  flex: 1 1 0;
  height: 32px;
  padding: 0 10px;
}

.tooltip-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.tooltip-sub {
  color: var(--muted);
  margin-bottom: 8px;
}

.tooltip-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-top: 1px solid #eef2f7;
}

.tooltip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.tooltip-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tooltip-row strong {
  font-size: 12px;
  font-weight: 700;
}

.data-panel {
  min-width: 0;
}

.data-panel-head {
  align-items: flex-start;
}

.data-panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.data-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.data-tabs button {
  height: 30px;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.data-tabs button.active {
  border-color: #bfd0e4;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(24, 32, 51, 0.08);
}

.data-actions {
  display: inline-flex;
  gap: 6px;
}

.data-actions button {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table-wrap {
  height: var(--table-height);
}

.optional-table-wrap {
  max-height: 320px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

#dataTable {
  min-width: 1320px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-weight: 600;
  background: var(--soft);
  padding: 10px;
}

tbody tr:hover {
  background: #fbfdff;
}

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

.numeric,
td:nth-child(6),
td:nth-child(7),
td:nth-child(8) {
  font-variant-numeric: tabular-nums;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.strong-number {
  color: var(--ink);
  font-weight: 700;
}

td a {
  color: var(--blue);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.desc {
  max-width: 280px;
  color: var(--muted);
  line-height: 1.4;
}

.copy-title {
  min-width: 260px;
  max-width: 420px;
  line-height: 1.35;
}

.copy-url {
  min-width: 220px;
  max-width: 340px;
  color: var(--muted);
  font-family: Consolas, "Segoe UI", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.optional-data-panel {
  padding: 0;
  overflow: hidden;
}

.optional-data-panel > summary {
  display: block;
  cursor: pointer;
  padding: 16px 16px 4px;
  list-style: none;
}

.optional-data-panel > summary::-webkit-details-marker {
  display: none;
}

.optional-data-panel > summary .panel-head {
  margin-bottom: 0;
}

.optional-data-panel > summary p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.optional-data-panel[open] {
  padding-bottom: 16px;
}

.optional-data-panel[open] .optional-table-wrap {
  margin: 10px 16px 0;
}

.live-workbench {
  display: grid;
  gap: 10px;
  margin: 10px 16px 0;
}

.live-toolbar {
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.live-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 6px;
}

.live-filters select,
.live-filters input,
.live-chart-actions select {
  height: 34px;
  font-size: 12px;
}

.live-actions,
.live-chart-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.live-actions button,
.live-chart-actions button {
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 700;
}

.live-table-wrap {
  max-height: 420px;
  margin: 0 !important;
}

#liveTable {
  min-width: 1480px;
}

#liveTable td,
#liveTable th {
  vertical-align: middle;
}

#liveTable input[type="checkbox"] {
  width: auto;
  height: auto;
}

#liveTable tr.is-selected {
  background: #eef5ff;
}

.live-title-cell {
  min-width: 250px;
  max-width: 380px;
  line-height: 1.35;
}

.live-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #526076;
  font-size: 12px;
  font-weight: 700;
}

.live-status[data-status="live"] {
  background: #e7f7ef;
  color: #14734c;
}

.live-status[data-status="waiting"] {
  background: #fff5df;
  color: #9a620d;
}

.live-status[data-status="archived"] {
  background: #eef2f7;
  color: #526076;
}

.live-status[data-status="expired"] {
  background: #fff0f0;
  color: #a23d3d;
}

.live-row-actions {
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.live-row-actions button {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.live-chart-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.live-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.live-chart-head h3 {
  margin: 0;
  color: var(--ink);
}

.live-chart-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.live-chart-canvas-wrap canvas {
  height: 390px;
}

.peak-number {
  color: #1d5bc2;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.version-edit {
  display: grid;
  grid-template-columns: 72px auto;
  gap: 6px;
  align-items: center;
  min-width: 132px;
}

.version-edit input {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.version-edit button {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf6f2;
  color: #27634b;
  font-size: 12px;
}

.danger {
  color: var(--red);
  border-color: #f1c7c7;
  background: #fff5f5;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
  white-space: pre-wrap;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .resize-handle {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    position: static;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-board.has-compare {
    grid-template-columns: 1fr;
  }

  .data-panel-head {
    flex-direction: column;
  }

  .live-toolbar {
    grid-template-columns: 1fr;
  }

  .live-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-actions {
    justify-content: flex-start;
  }

  .chart-tools {
    grid-template-columns: minmax(0, 1fr) 34px 34px;
    width: 100%;
  }

  .controls {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  main {
    padding: 14px;
  }

  .topbar {
    padding: 16px;
  }

  .topbar-actions,
  .topbar-actions button,
  .side-toggle {
    width: 100%;
  }

  .panel,
  .chart-panel {
    padding: 14px;
  }

  :root {
    --chart-height: 440px;
    --table-height: 300px;
  }

  .field-line {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}
