@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables & Design System --- */
:root {
  /* Cozy Craft Theme (Default) */
  --bg-app: #f7f4ef;
  --bg-sidebar: rgba(255, 255, 255, 0.75);
  --bg-card: #ffffff;
  --text-main: #4a3e3d;
  --text-muted: #8c7e7c;
  --border-color: #e8e2d5;
  --accent-color: #d9745b;
  --accent-hover: #c8634a;
  --accent-light: rgba(217, 116, 91, 0.1);
  --shadow-sm: 0 2px 8px rgba(74, 62, 61, 0.05);
  --shadow-md: 0 8px 24px rgba(74, 62, 61, 0.08);
  --shadow-lg: 0 16px 40px rgba(74, 62, 61, 0.12);
  --glass-blur: 12px;
  --glass-border: rgba(255, 255, 255, 0.4);
  --grid-border: rgba(74, 62, 61, 0.08);
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Knitted texture overlay SVG - base64 encoded for seamless loading */
  --knit-pattern: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0c2 3.5 2 8.5 0 12m12-12c2 3.5 2 8.5 0 12M12 0c-2 3.5-2 8.5 0 12m12-12c-2 3.5-2 8.5 0 12' fill='none' stroke='rgba(255,255,255,0.22)' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M0 0c2 3.5 2 8.5 0 12m12-12c2 3.5 2 8.5 0 12M12 0c-2 3.5-2 8.5 0 12m12-12c-2 3.5-2 8.5 0 12' fill='none' stroke='rgba(0,0,0,0.12)' stroke-width='1' stroke-linecap='round'/%3E%3Cpath d='M0 12c2 3.5 2 8.5 0 12m12-12c2 3.5 2 8.5 0 12M12 12c-2 3.5-2 8.5 0 12m12-12c-2 3.5-2 8.5 0 12' fill='none' stroke='rgba(255,255,255,0.22)' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M0 12c2 3.5 2 8.5 0 12m12-12c2 3.5 2 8.5 0 12M12 12c-2 3.5-2 8.5 0 12m12-12c-2 3.5-2 8.5 0 12' fill='none' stroke='rgba(0,0,0,0.12)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  
  --fringe-pattern: url("data:image/svg+xml,%3Csvg width='12' height='30' viewBox='0 0 12 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 0v30M6 0v28M10 0v30' stroke='rgba(74, 62, 61, 0.4)' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-sidebar: rgba(255, 255, 255, 0.8);
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
  --glass-border: rgba(255, 255, 255, 0.6);
  --grid-border: rgba(15, 23, 42, 0.08);
  --fringe-pattern: url("data:image/svg+xml,%3Csvg width='12' height='30' viewBox='0 0 12 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 0v30M6 0v28M10 0v30' stroke='rgba(15, 23, 42, 0.3)' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-sidebar: rgba(17, 24, 39, 0.75);
  --bg-card: #111827;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --border-color: #1f2937;
  --accent-color: #ec4899;
  --accent-hover: #db2777;
  --accent-light: rgba(236, 72, 153, 0.15);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
  --glass-border: rgba(31, 41, 55, 0.4);
  --grid-border: rgba(243, 244, 246, 0.08);
  --fringe-pattern: url("data:image/svg+xml,%3Csvg width='12' height='30' viewBox='0 0 12 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 0v30M6 0v28M10 0v30' stroke='rgba(243, 244, 246, 0.25)' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}

/* --- Base Styles & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* --- Typography --- */
h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* --- Layout --- */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  min-height: 0; /* Fix flex layout containment */
  position: relative;
  overflow: hidden;
}

/* Header */
.app-header {
  height: 64px;
  padding: 0 24px;
  background-color: var(--bg-sidebar);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.8rem;
  animation: float 3s ease-in-out infinite;
  display: inline-block;
}

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

/* Sidebar Styling (Glassmorphic) */
.app-sidebar {
  width: 380px;
  height: 100%;
  min-height: 0; /* Fix nested flex height containment */
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  gap: 24px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Workspace */
.app-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* Fix flex height containment */
  background-color: var(--bg-app);
  position: relative;
  overflow: hidden;
}

/* --- Card Panel Styling --- */
.config-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.config-panel:hover {
  box-shadow: var(--shadow-md);
}

/* Form Controls */
.control-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input, .input-group select {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Button & Tool Styling */
.btn {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  user-select: none;
}

.btn:hover {
  background-color: var(--border-color);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

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

.btn-primary:focus {
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.btn-full {
  width: 100%;
}

/* --- Color Palette Manager --- */
.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  margin: 12px 0;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px;
}

.swatch-wrapper {
  position: relative;
  aspect-ratio: 1;
}

.color-swatch {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.1), var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.color-swatch::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--knit-pattern);
  background-size: 16px;
  opacity: 0.45;
  pointer-events: none;
}

.color-swatch.active {
  border-color: var(--text-main);
  transform: scale(1.1);
  box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-md);
  z-index: 5;
}

.swatch-wrapper:hover .color-swatch {
  transform: scale(1.08);
}

.delete-swatch-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--text-main);
  color: var(--bg-card);
  border: none;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.swatch-wrapper:hover .delete-swatch-btn {
  opacity: 1;
  transform: scale(1);
}

/* Custom Visual Color Picker */
.palette-creator {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

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

.color-picker-input-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.visual-color-picker {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 62px;
  height: 62px;
  border: none;
  cursor: pointer;
  background: none;
  padding: 0;
}

.picker-name-input {
  flex: 1;
  height: 42px;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
}

.picker-name-input:focus {
  border-color: var(--accent-color);
}

/* Pre-loaded Palette Selector */
.preloaded-palettes {
  margin-top: 10px;
}

.palette-preset-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

.palette-preset-btn:hover {
  background-color: var(--border-color);
}

.preset-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.preset-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.preset-colors-preview {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.preset-preview-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

/* --- Shopping List / Stats Panel --- */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-app);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.stat-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
}

.stat-color-name {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-numbers {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-count {
  font-weight: 700;
}

.stat-percentage {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-skeins {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-color);
}

.blanket-summary {
  display: flex;
  justify-content: space-around;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

/* --- Blanket Canvas Workspace --- */
.canvas-wrapper {
  flex: 1;
  height: 100%;
  min-height: 0; /* Fix nested scrolling container dimensions */
  display: flex;
  overflow: auto;
  padding: 40px;
  position: relative;
  cursor: grab;
  /* align-items and justify-content removed to fix flexbox centering scroll bug. Centering is handled by margin: auto on the child .blanket-container */
}

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

/* Zoom/Controls floating panel */
.floating-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-sidebar);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
}

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

.floating-btn {
  background: none;
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.floating-btn:hover {
  background-color: var(--accent-light);
  color: var(--accent-color);
}

.floating-btn:active {
  transform: scale(0.95);
}

.zoom-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 42px;
  text-align: center;
  color: var(--text-main);
  user-select: none;
}

/* The Blanket Visual Structure */
.blanket-container {
  margin: auto; /* Perfectly centers child in flex parent while allowing full scrollability under overflow */
  display: inline-block;
  position: relative;
  padding: 12px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-lg);
  transform-origin: center center;
  transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Blanket fringe styling for that organic realistic look */
.blanket-container::after {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 18px;
  right: 18px;
  height: 24px;
  background-image: var(--fringe-pattern);
  background-size: 12px 30px;
  background-repeat: repeat-x;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.blanket-container::before {
  content: '';
  position: absolute;
  top: -22px;
  left: 18px;
  right: 18px;
  height: 24px;
  background-image: var(--fringe-pattern);
  background-size: 12px 30px;
  background-repeat: repeat-x;
  transform: rotate(180deg);
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.3s;
}

/* Disable fringe pattern when realistic is off */
.flat-style.blanket-container::after,
.flat-style.blanket-container::before {
  opacity: 0 !important;
}

.blanket-grid {
  display: grid;
  gap: 1px; /* Stitch line separation */
  background-color: var(--grid-border);
  border: 1px solid var(--grid-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  user-select: none;
}

/* Grid Patchwork Squares */
.grid-cell {
  aspect-ratio: 1;
  background-color: #ffffff;
  position: relative;
  cursor: cell;
  transition: background-color 0.2s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.2s;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.08);
}

.grid-cell:hover {
  filter: brightness(1.05);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.15), 0 0 8px rgba(255,255,255,0.4);
  z-index: 10;
}

.grid-cell.preview-paint {
  filter: brightness(0.9) saturate(1.2);
}

/* Realistic Knitted Overlay Texture */
.knit-style .grid-cell::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--knit-pattern);
  background-size: 18px;
  pointer-events: none;
  opacity: 0.6;
  mix-blend-mode: overlay;
  transition: opacity 0.3s;
}

.knit-style .grid-cell {
  box-shadow: inset 0 0 6px rgba(0,0,0,0.22), inset 0 2px 2px rgba(255,255,255,0.3);
  border-radius: 2px;
}

/* --- Theme Toggle Styles --- */
.theme-selector {
  display: flex;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
}

.theme-opt {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.theme-opt.active {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Interactive elements */
.switch-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.switch-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

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

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* Export Overlay (Modal) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-input {
  width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  margin-top: 12px;
  word-break: break-all;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background-color: var(--text-main);
  color: var(--bg-card);
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 300;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Responsive Overrides - Trigger stack view only on narrow screens */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }
  .app-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow-y: visible;
    height: auto;
  }
  .app-workspace {
    height: 600px;
    position: relative;
  }
  .floating-controls {
    bottom: 16px;
  }
}
