/* GWDE — Groundwater Dashboard Explorer */

:root {
  --color-primary: #1a73e8;
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #555;
  --color-border: #e0e0e0;
  --header-height: 52px;
  --controls-height: 56px;
  --radius: 6px;
  --min-target: 44px;
  --focus-ring: 0 0 0 2px var(--color-primary);
}

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

/* WCAG 2.5 — Focus indicators for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 10000;
  font-size: 0.85rem;
}

.skip-link:focus {
  top: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  height: 100vh;
  overflow: hidden;
}

/* ---- Prototype banner ---- */

.gwde-proto-banner {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.65rem;
  text-align: center;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--color-border);
  opacity: 0.7;
}

/* ---- Header ---- */

.gwde-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
}

.gwde-header h1 {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.gwde-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.gwde-layout-switch {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.gwde-layout-switch button {
  padding: 0.4rem 0.8rem;
  min-height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.gwde-layout-switch button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.gwde-layout-switch button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.gwde-layout-switch button.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ---- Theme editor ---- */

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: 0.3rem;
  flex-shrink: 0;
  transition: background 0.15s;
}

.theme-toggle-btn:hover,
.theme-toggle-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}



/* ---- Controls ---- */

.control-panel {
  height: var(--controls-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.control-group select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: white;
  max-width: 260px;
}

.control-year {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-year strong {
  color: var(--color-primary);
  min-width: 2.5em;
  display: inline-block;
  transition: color 0.3s;
}

.control-year strong.changing {
  color: #e65100;
}

.year-slider-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.year-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
  margin: 0;
}

.year-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #aaa;
  padding: 0;
  user-select: none;
}

.year-ticks span.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* ---- Main layout ---- */

.gwde-main {
  height: calc(100vh - var(--header-height) - var(--controls-height));
  display: flex;
  position: relative;
}

/* Custom elements need explicit display to participate in flex layout */
map-view {
  display: block;
  overflow: hidden;
  height: 100%;
}

chart-panel {
  display: block;
  overflow: hidden;
  height: 100%;
}

control-panel {
  display: block;
}

/* Layout A: full-bleed map, chart panel appears on click */
.gwde-layout-A map-view {
  flex: 1;
  min-width: 0;
}

.gwde-layout-A chart-panel {
  width: 360px;
  flex-shrink: 0;
}

/* Layout B: 60% map + 40% chart panel always visible */
.gwde-layout-B map-view {
  flex: 6;
  min-width: 0;
}

.gwde-layout-B chart-panel {
  flex: 4;
  min-width: 0;
}

.gwde-layout-B story-panel {
  flex: 4;
  min-width: 0;
  height: 100%;
  display: block;
  overflow: hidden;
}

/* Layout C: compare view fills the whole main area */
.gwde-layout-C compare-view {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: block;
}

/* ---- Compare view ---- */

.compare-container {
  display: flex;
  height: 100%;
  width: 100%;
}

.compare-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.compare-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.compare-header select {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: white;
}

.compare-label {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compare-map {
  flex: 1;
  min-height: 0;
}

.compare-divider {
  width: 3px;
  background: var(--color-primary);
  flex-shrink: 0;
  cursor: col-resize;
}

.compare-legend {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  font-size: 0.75rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.compare-legend .legend-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.compare-legend .legend-gradient {
  width: 80px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(to right,
    rgba(50, 180, 50, 0.7),
    rgba(255, 150, 20, 0.7),
    rgba(255, 0, 20, 0.7)
  );
}

/* ---- Map ---- */

.map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.map {
  width: 100%;
  height: 100%;
}

.map-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  white-space: nowrap;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.map-legend {
  position: absolute;
  bottom: 2rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  font-size: 0.75rem;
  z-index: 10;
}

.legend-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.legend-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-gradient {
  flex: 1;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(to right,
    rgba(50, 180, 50, 0.7),
    rgba(255, 150, 20, 0.7),
    rgba(255, 0, 20, 0.7)
  );
}

.legend-low, .legend-high {
  font-size: 0.7rem;
  color: #666;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #888;
  margin-top: 2px;
}

/* ---- Chart panel ---- */

.chart-panel {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.chart-region-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.chart-back {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.chart-back:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.chart-wrapper {
  position: relative;
  height: 260px;
  min-height: 200px;
}

.chart-hint {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  padding: 2rem;
}

/* ---- Insights panel ---- */

insights-panel {
  display: block;
  height: 100%;
  overflow: hidden;
}

.insights-panel {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  padding: 0.8rem;
  overflow-y: auto;
  height: 100%;
}

.gwde-layout-A insights-panel {
  width: 360px;
  flex-shrink: 0;
}

.insights-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.8rem;
  line-height: 1.4;
}

.insight-section {
  margin-bottom: 1rem;
}

.insight-section h4 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--color-border);
}

.insight-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 0.8rem;
  text-align: left;
  transition: background 0.1s;
}

.insight-row:hover {
  background: var(--color-bg);
}

.insight-iso {
  font-weight: 600;
  min-width: 2.5em;
  color: var(--color-text);
}

.insight-score {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--color-text);
}

.insight-detail {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  margin-left: auto;
}

.insight-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
  margin-left: auto;
}

.insight-high { background: #ffebee; color: #c62828; }
.insight-moderate { background: #fff3e0; color: #e65100; }
.insight-low { background: #e8f5e9; color: #2e7d32; }

.insight-alert .insight-score {
  color: #c62828;
  font-weight: 600;
}

/* ---- Annotations ---- */

.annotations-section {
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
}

.annotations-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text-secondary);
}

.annotation-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.annotation-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
}

.annotation-text {
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.annotation-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.annotation-delete {
  margin-left: auto;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #666;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.4rem;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.annotation-delete:hover {
  color: #c62828;
}

.annotation-empty {
  font-size: 0.78rem;
  color: #aaa;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.annotation-form {
  display: flex;
  gap: 0.3rem;
}

.annotation-form input {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.annotation-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.annotation-form button {
  padding: 0.35rem 0.7rem;
  min-width: 36px;
  min-height: 36px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---- Story panel ---- */

.story-panel {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.story-nav {
  display: flex;
  gap: 2px;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}

.story-nav-btn {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s;
}

.story-nav-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.3);
}

.story-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 0 0 60vh 0;
}

.story-card {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.2s;
  min-height: 50%;
}

.story-card.active {
  background: rgba(26, 115, 232, 0.04);
  border-left: 3px solid var(--color-primary);
}

.story-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.story-meta {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.story-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.story-body {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--color-text);
}

/* ---- Guided tour ---- */

.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 9000;
}

.tour-popup {
  position: fixed;
  z-index: 9001;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  padding: 1rem 1.2rem;
  max-width: 320px;
  min-width: 240px;
}

.tour-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tour-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.tour-counter {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.tour-content {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-text);
  margin-bottom: 0.8rem;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-skip {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
}

.tour-skip:hover {
  color: var(--color-text);
}

.tour-nav {
  display: flex;
  gap: 0.3rem;
}

.tour-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  background: white;
}

.tour-next {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.tour-prev {
  color: var(--color-text-secondary);
}

/* ---- Info popovers ---- */

.info-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.info-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.info-popover {
  position: absolute;
  top: calc(var(--controls-height) + 4px);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0.8rem;
  max-width: 340px;
  z-index: 100;
  font-size: 0.8rem;
  line-height: 1.5;
}

.info-popover strong {
  display: block;
  margin-bottom: 0.3rem;
}

.info-popover p {
  margin: 0.3rem 0;
  color: var(--color-text);
}

.info-scoring {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ---- Help button ---- */

.gwde-help-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 0.3rem;
  flex-shrink: 0;
}

.gwde-help-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---- Legend categories ---- */

.legend-categories {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  margin-top: 2px;
  font-weight: 500;
}

.legend-cat {
  white-space: nowrap;
}

/* ---- Design system page ---- */

design-system {
  display: block;
  height: 100%;
  overflow-y: auto;
}

.ds-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
}

.ds-section {
  margin-bottom: 2rem;
}

.ds-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

.ds-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.ds-colors {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.ds-color-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.ds-color-swatch {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.ds-color-label {
  font-size: 0.75rem;
  font-weight: 600;
}

.ds-color-value {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
}

.ds-color-card input[type="color"] {
  width: 32px;
  height: 20px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 1px;
  cursor: pointer;
}

.ds-type-scale h1 { margin-bottom: 0.3rem; }
.ds-type-scale h2 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.ds-type-scale h3 { font-size: 0.9rem; margin-bottom: 0.3rem; }
.ds-type-scale p { font-size: 0.88rem; line-height: 1.6; margin-bottom: 0.3rem; }
.ds-type-scale .ds-small { font-size: 0.72rem; color: var(--color-text-secondary); font-style: italic; }
.ds-type-scale label { font-size: 0.75rem; font-weight: 500; color: var(--color-text-secondary); }

.ds-type-meta {
  margin-top: 0.5rem;
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.ds-type-meta code {
  background: var(--color-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

/* DS buttons */
.ds-btn-primary {
  padding: 0.4rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
}

.ds-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ds-btn-secondary {
  padding: 0.4rem 1rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
}

.ds-btn-active {
  padding: 0.3rem 0.7rem;
  background: var(--color-primary);
  color: white;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
}

.ds-btn-inactive {
  padding: 0.3rem 0.7rem;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
}

.ds-btn-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
}

.ds-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ds-control label {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.ds-control select,
.ds-control input[type="text"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  background: white;
  min-width: 180px;
}

.ds-control input[type="range"] {
  width: 180px;
  accent-color: var(--color-primary);
}

.ds-card-container {
  max-width: 400px;
}

.ds-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem;
}

.ds-preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.ds-preset-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.ds-preset-colors {
  display: flex;
  gap: 3px;
}

.ds-preset-colors span {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.ds-preset-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.ds-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ds-token-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ds-token-row label {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  min-width: 4em;
  font-weight: 500;
}

.ds-token-row input[type="color"] {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px;
  cursor: pointer;
}

.ds-token-row input[type="range"] {
  width: 80px;
  accent-color: var(--color-primary);
}

.ds-token-row input[type="text"] {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.78rem;
  width: 220px;
}

.ds-token-row select {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.78rem;
}

.ds-token-row code {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.ds-presets-grid {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.ds-preset-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  min-width: 120px;
}

.ds-preset-colors {
  display: flex;
  gap: 3px;
  cursor: pointer;
}

.ds-preset-colors span {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.ds-preset-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: default;
}

.ds-preset-name-input {
  font-size: 0.75rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--color-primary);
  border-radius: 3px;
  outline: none;
  width: 100%;
}

.ds-preset-actions {
  display: flex;
  gap: 0.3rem;
}

.ds-preset-apply {
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.ds-preset-delete {
  padding: 0.2rem 0.4rem;
  font-size: 0.78rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  color: #999;
}

.ds-preset-delete:hover {
  color: #c62828;
  border-color: #c62828;
}

.ds-preset-new {
  border-style: dashed;
  justify-content: center;
  align-items: center;
}

.ds-preset-new input {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  width: 100%;
}

.ds-toast-preview {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* ---- Loading ---- */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 1.2rem;
  color: var(--color-text-secondary);
}
