:root{
  --bg:#f7f8fb;
  --card:#ffffff;
  --muted:#666;
  --accent:#276ef1;
  --accent-600:#1f5ad6;
  --gap:12px;
  --radius:10px;
  --shadow:0 6px 18px rgba(20,20,30,0.04);
  --touch:48px;
  --small-break:760px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  margin:0; padding:16px; background:var(--bg); color:#111;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* layout */
.wrap{
  max-width:1200px;
  margin:0 auto;
  display:grid;
  grid-template-columns:360px 1fr;
  gap:18px;
  align-items:start;
}

/* cards */
.card{
  background:var(--card);
  padding:14px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

/* headings & labels */
h1{ margin:0 0 10px 0; font-size:20px; }
label{ display:block; font-size:13px; color:var(--muted); margin-top:8px; }
.muted{ color:var(--muted); font-size:13px; }

/* inputs */
textarea,input,select,button{
  font-family:inherit;
  font-size:14px;
}
textarea,input,select{
  width:100%; box-sizing:border-box; padding:10px; border-radius:8px; border:1px solid #e6e9ef;
  background:#fff;
}
textarea{ min-height:140px; resize:vertical; }
input[type="color"]{ padding:2px; height:40px; width:48px; }

/* small text */
.small{ font-size:13px; color:var(--muted); margin-top:6px; }

/* controls */
.controls{ display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
button{ background:var(--accent); color:white; border:none; padding:10px 14px; border-radius:8px; cursor:pointer; font-weight:600; min-height:var(--touch); display:inline-flex; align-items:center; justify-content:center; }
button.secondary{ background:#f3f6ff; color:var(--accent); }
.btn-ghost{ background:transparent; color:var(--accent); border:1px solid #e6e9ef; }

/* canvas area */
#canvasWrapper{ display:flex; flex-direction:column; gap:10px; }
#chartContainer{ background:#fff; border-radius:8px; padding:12px; display:flex; justify-content:center; align-items:center; min-height:300px; }
#chartCanvas{ max-width:100%; height:auto; width:100%; }

/* layout helpers */
.row{ display:flex; gap:8px; align-items:center; }
.options{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }

/* series-list (same as before) */
.series-list {
  margin-top: 10px;
  border-top: 1px dashed #e6e9ef;
  padding-top: 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.series-row {
  display:flex;
  align-items:center;
  justify-content:space-between; /* name left, color picker right */
  gap:8px;
  padding:6px 4px;
  border-radius:6px;
}
.series-name {
  font-size:13px;
  color:#111;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:220px;
}
.series-color {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border-radius:4px;
  border:1px solid #ddd;
  padding:0;
}
.series-color input[type="color"]{
  width:28px;
  height:28px;
  padding:0;
  border:0;
  background:transparent;
  appearance:none;
  cursor:pointer;
}
.series-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.series-color input[type="color"]::-webkit-color-swatch { border: none; border-radius:3px; }

/* small screens: stack, enlarge targets */
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; padding:12px; gap:12px; }
  .card { padding:12px; }
  .options { grid-template-columns: 1fr; }
  .row { flex-direction:row; }
  .controls { flex-direction:column; }
  button { width:100%; }
  .series-name { max-width:160px; }
  #chartContainer { min-height:260px; padding:10px; }
  h1 { font-size:18px; }
}

/* very small screens */
@media (max-width: 420px) {
  body { padding:10px; }
  textarea, input, select { padding:8px; font-size:15px; }
  .series-name { max-width:120px; font-size:14px; }
  .small { font-size:12px; }
  #chartContainer { min-height:220px; }
}

/* accessibility focus states */
input:focus, textarea:focus, select:focus, button:focus {
  outline: 3px solid rgba(39,110,241,0.15);
  outline-offset: 2px;
  border-color: var(--accent-600);
}
