/* Modern Design System for Open Source Mermaid Studio */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-surface: #1e293b;
  --bg-glass: rgba(30, 41, 59, 0.85);
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-highlight: #475569;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-pink: #ec4899;
  --accent-pink-hover: #db2777;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;
  --grid-dot-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-highlight: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --grid-dot-color: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header Navbar */
.app-header {
  height: 54px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  user-select: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
}

.brand-badge {
  background: var(--accent-pink);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.file-title-container:hover {
  background: var(--bg-tertiary);
}

.file-path {
  color: var(--text-muted);
  font-size: 13px;
}

.file-name-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  outline: none;
  width: 180px;
  font-family: inherit;
}

.file-name-input:focus {
  border-bottom: 1px solid var(--accent-blue);
}

/* Header Center - Mode Switcher */
.header-center {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.mode-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.mode-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-highlight);
}

.btn-primary {
  background: var(--accent-pink);
  border-color: var(--accent-pink);
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-pink-hover);
  border-color: var(--accent-pink-hover);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.btn-ai:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-icon-only {
  padding: 6px;
  width: 32px;
  height: 32px;
}

/* Main Workspace Split Layout */
.workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar Left */
.sidebar {
  width: 380px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.sidebar.collapsed {
  width: 0px;
  overflow: hidden;
  border-right: none;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

/* Sits alongside the tabs but must not stretch like them. */
.tab-close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  border: none;
  border-left: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-close:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-pink);
  border-bottom-color: var(--accent-pink);
  background: var(--bg-secondary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

.tab-panel.active {
  display: flex;
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-secondary);
}

.switch-input {
  display: none;
}

.switch-slider {
  width: 32px;
  height: 18px;
  background: var(--bg-tertiary);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch-input:checked + .switch-slider {
  background: var(--accent-green);
}

.switch-input:checked + .switch-slider::after {
  transform: translateX(14px);
}

/* Code Editor Container */
.code-editor-container {
  flex: 1;
  display: flex;
  position: relative;
  background: var(--bg-input);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

.line-numbers {
  padding: 12px 8px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  color: var(--text-muted);
  text-align: right;
  user-select: none;
  min-width: 40px;
  font-size: 12px;
}

.code-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 12px;
  resize: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
  overflow-y: auto;
}

/* Error Diagnostic Banner */
.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border-top: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  display: none;
  max-height: 120px;
  overflow-y: auto;
}

.error-banner.visible {
  display: block;
}

/* Accordions & Pills Section */
.sidebar-section {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sample-pills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.sample-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.sample-pill:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-pink);
}

.sample-pill.active {
  background: var(--accent-pink);
  color: white;
  border-color: var(--accent-pink);
}

.sample-pill.highlight {
  border-color: var(--accent-purple);
  color: #a78bfa;
}

/* Action Buttons Grid */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* Main Canvas Area */
.canvas-viewport {
  flex: 1;
  position: relative;
  background-color: #ffffff;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-viewport:active {
  cursor: grabbing;
}

/* Select tool: the pointer stays a pointer and diagram text can be highlighted,
   instead of every drag being swallowed as a pan. */
.canvas-viewport[data-tool="select"],
.canvas-viewport[data-tool="select"]:active {
  cursor: default;
}

/* Without this, a touchscreen treats a drag on the canvas as a page scroll and
   stops delivering pointermove after a few pixels — which is exactly why pan
   felt dead on iPad and Surface. Scoped to pan mode so the select tool keeps
   native scrolling and text selection. */
.canvas-viewport[data-tool="pan"] {
  touch-action: none;
}

.canvas-viewport[data-tool="select"] {
  touch-action: auto;
}

/* Palette dropped by the insert tools. Anchored under the toolbar it belongs to. */
.tool-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  max-height: 60vh;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.tool-popover[hidden] {
  display: none;
}

.tool-popover h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.popover-grid {
  display: grid;
  grid-template-columns: repeat(5, 64px);
  gap: 6px;
}

.popover-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 58px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font: inherit;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.popover-item:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.popover-item svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.popover-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Dragging in pan mode must not paint a text selection across the diagram. */
.canvas-viewport[data-tool="pan"] .mermaid-target {
  user-select: none;
  -webkit-user-select: none;
}

.canvas-container {
  transform-origin: 0 0;
  transition: transform 0.05s ease-out;
  display: inline-block;
  padding: 40px;
}

.mermaid-target {
  display: flex;
  justify-content: center;
  align-items: center;
}

.mermaid-target svg {
  max-width: none !important;
  height: auto !important;
}

/* Top Floating Canvas Toolbar (Screenshot 2 Style) */
.canvas-top-toolbar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

.select-dropdown {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}

/* Floating Bottom Controls (Screenshot 1 & 2) */
.canvas-bottom-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow-md);
  z-index: 30;
}

.canvas-bottom-left-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  z-index: 30;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Floating Code Window (Screenshot 2 Floating Panel Mode) */
.floating-code-panel {
  position: absolute;
  top: 80px;
  left: 24px;
  width: 420px;
  height: 520px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
  resize: both;
}

.floating-panel-header {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  font-size: 13px;
  font-weight: 600;
}

/* Floating Bottom Action Buttons in Code Panel ("Use Voice", "Use AI") */
.floating-panel-footer {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Prompt presets pills */
.prompt-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-pink);
}

.modal-textarea {
  width: 100%;
  height: 110px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.modal-textarea:focus {
  border-color: var(--accent-purple);
}

/* Voice Dictation Visualizer */
.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  margin: 10px 0;
}

.wave-bar {
  width: 4px;
  height: 8px;
  background: var(--accent-pink);
  border-radius: 2px;
  animation: wavePulse 1s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wavePulse {
  0% { height: 8px; }
  100% { height: 32px; }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-highlight);
}

/* ── Export dialog ────────────────────────────────────────────────────────
   Mirrors the mermaid.ai layout: format list + background swatches on the
   left, live preview on the right, actions along the bottom. */
.modal-card-export { max-width: 860px; width: 92vw; }

.export-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 22px;
}
/* One column on narrow screens — this app is used on iPad and Surface. */
@media (max-width: 720px) {
  .export-grid { grid-template-columns: 1fr; }
  .export-preview { min-height: 180px; }
}

.export-col { min-width: 0; }   /* grid items default to min-width:auto, which
                                    lets the preview column grow past the card
                                    instead of scrolling inside it */

.export-label {
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-secondary); margin-bottom: 10px;
}

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

.export-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 9px; cursor: pointer;
  border: 1.5px solid var(--border-color);
  background: var(--bg-tertiary);
  transition: border-color .15s, background .15s;
}
.export-opt:hover { border-color: var(--accent-pink); }
.export-opt.selected { border-color: var(--accent-pink); background: rgba(236,72,153,.10); }
.export-opt input { position: absolute; opacity: 0; pointer-events: none; }

.export-radio {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--text-muted); position: relative;
}
.export-opt.selected .export-radio { border-color: var(--accent-pink); }
.export-opt.selected .export-radio::after {
  content: ""; position: absolute; inset: 2.5px;
  border-radius: 50%; background: var(--accent-pink);
}

.export-opt-name { display: block; font-weight: 600; font-size: 13px; }
.export-opt-desc { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.export-swatches { display: flex; gap: 10px; align-items: center; }
.swatch {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--border-color); padding: 0;
  display: grid; place-items: center; position: relative;
}
.swatch.selected { border-color: var(--accent-pink); box-shadow: 0 0 0 2px rgba(236,72,153,.28); }
/* Checkerboard so "transparent" reads as transparent rather than as white. */
.swatch-alpha {
  background-image:
    linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%),
    linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px; background-color: #fff;
}
.swatch-custom { background: var(--bg-tertiary); color: var(--text-secondary); overflow: hidden; }
.swatch-custom input[type="color"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; border: 0; padding: 0;
}

.export-note { font-size: 11px; color: var(--text-muted); margin: 14px 0 0; line-height: 1.5; min-height: 30px; }

.export-preview {
  border: 1.5px solid var(--border-color); border-radius: 10px;
  min-height: 300px; max-height: 46vh; overflow: auto;
  display: grid; place-items: center; padding: 14px;
  background: #ffffff;
}
.export-preview svg { max-width: 100%; height: auto; }
.export-preview-empty { color: var(--text-muted); font-size: 12px; }

.export-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color);
}

/* ── Personal files (repo-backed) ─────────────────────────────────────────── */
.file-path-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--text-muted);
  cursor: pointer; text-decoration: none;
}
.file-path-btn:hover { color: var(--accent-pink); text-decoration: underline; }

.files-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.files-repo { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

.files-list {
  border: 1.5px solid var(--border-color); border-radius: 10px;
  max-height: 46vh; overflow: auto; background: var(--bg-tertiary);
}
.files-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-bottom: 1px solid var(--border-color);
}
.files-row:last-child { border-bottom: 0; }
.files-row:hover { background: rgba(255,255,255,.03); }
.files-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-name.current { color: var(--accent-pink); font-weight: 600; }
.files-size { font-size: 11px; color: var(--text-muted); }
.files-empty { padding: 26px; text-align: center; color: var(--text-muted); font-size: 12px; }

.files-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.files-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.files-form-wide { grid-column: 1 / -1; }
.files-form input {
  background: var(--bg-tertiary); border: 1.5px solid var(--border-color);
  border-radius: 8px; padding: 9px 11px; color: var(--text-primary);
  font-size: 13px; font-family: inherit;
}
.files-form input:focus { outline: none; border-color: var(--accent-pink); }

.files-warning {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
  padding: 12px 14px; border-radius: 9px; font-size: 11.5px; line-height: 1.55;
  background: rgba(180,69,58,.12); border: 1px solid rgba(180,69,58,.45);
  color: var(--text-secondary);
}
.files-warning strong { color: var(--text-primary); display: block; margin-bottom: 3px; }
@media (max-width: 720px) { .files-form { grid-template-columns: 1fr; } }
