/* ===== Bobble — Crochet Chart Maker ===== */

/* --- Tokens --- */
:root {
  --primary: #E8927C;
  --primary-dark: #D4735D;
  --primary-light: #F4C4B5;
  --secondary: #7CB5B3;
  --secondary-dark: #5A9997;
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-alt: #F3EDE6;
  --text: #2D2520;
  --text-secondary: #6B5E57;
  --text-muted: #A89C95;
  --border: #E8E0D8;
  --shadow: rgba(45,37,32,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --spacing: 16px;
  --header-h: 56px;
  --tabs-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- High contrast mode --- */
.high-contrast {
  --bg: #1a1a1a;
  --surface: #2a2a2a;
  --surface-alt: #333;
  --text: #f0f0f0;
  --text-secondary: #ccc;
  --text-muted: #999;
  --border: #555;
  --primary: #F0A090;
  --primary-dark: #F4B8A8;
  --primary-light: #4a3530;
  --shadow: rgba(0,0,0,.3);
}
.high-contrast .btn-full { box-shadow: 0 -4px 12px rgba(26,26,26,.9); }
.high-contrast .modal { background: var(--surface); color: var(--text); }
.high-contrast .color-picker { background: var(--surface); color: var(--text); }
.high-contrast input, .high-contrast select, .high-contrast textarea { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.high-contrast .palette-name-input { color: var(--text); }
.high-contrast .palette-yarn-note { color: var(--text-muted); }
.high-contrast .minimap { background: var(--surface); }

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; }
img { display: block; max-width: 100%; }

/* --- Layout --- */
#app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
#header-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}
.header-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border-radius: var(--radius-sm);
}
.header-btn:active { background: var(--surface-alt); }

#app-main {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* --- Views --- */
.view {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--spacing);
  padding-bottom: calc(var(--spacing) + var(--safe-bottom) + 70px);
  display: none;
  animation: fadeIn .2s ease;
}
.view.active { display: block; }
.view[data-has-tabs] { padding-bottom: calc(var(--tabs-h) + var(--safe-bottom) + var(--spacing)); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Typography --- */
.section-title {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 0; }
.subtle { color: var(--text-muted); font-size: 14px; }
.badge {
  display: inline-block; min-width: 28px; text-align: center;
  background: var(--primary); color: white;
  font-size: 13px; font-weight: 700;
  border-radius: 14px; padding: 2px 8px;
}

/* --- Buttons --- */
.btn-primary {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 24px;
  border-radius: var(--radius);
  transition: background .15s;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-full {
  display: block;
  width: calc(100% - 2 * var(--spacing));
  position: sticky;
  bottom: 0;
  margin: 16px auto 0;
  z-index: 10;
  box-shadow: 0 -4px 12px rgba(250,247,242,.9);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.link-btn {
  color: var(--primary-dark);
  font-size: 14px;
  padding: 12px 8px;
  min-height: 44px;
  text-decoration: underline;
}

.icon-btn {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.icon-btn:active { background: var(--surface-alt); }

.tool-btn {
  padding: 10px 14px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
}
.tool-btn:active { background: var(--surface-alt); }
.tool-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.tool-toggle {
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.tool-toggle input { margin: 0; width: 18px; height: 18px; }

/* --- FAB --- */
.fab {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 32px;
  font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 50;
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  max-width: calc(100% - 32px);
  text-align: center;
  opacity: 0;
  transition: transform .3s, opacity .3s;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: var(--spacing);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }

/* --- Color picker --- */
.color-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
}
.color-picker-overlay[hidden] { display: none; }
.color-picker {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}
.color-picker h3 { margin-bottom: 16px; }
.color-picker input[type="color"] {
  width: 80px; height: 80px;
  border: none; padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.color-picker-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: center; }

/* ==================== HOME ==================== */
.home-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60vh;
  text-align: center;
}
.home-empty-icon { font-size: 64px; margin-bottom: 16px; opacity: .5; }

.project-list { display: flex; flex-direction: column; gap: 12px; }

.project-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: background .15s;
}
.project-card:active { background: var(--surface-alt); }
.project-thumb {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  object-fit: cover;
  flex-shrink: 0;
}
.project-info { flex: 1; min-width: 0; }
.project-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: 13px; color: var(--text-muted); }
.project-delete {
  width: 44px; height: 44px;
  font-size: 20px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.project-delete:active { background: var(--surface-alt); }

/* ==================== UPLOAD ==================== */
.upload-area {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 60vh;
  border: 3px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.upload-icon { font-size: 64px; opacity: .4; margin-bottom: 12px; }
.upload-text { font-size: 18px; font-weight: 600; }

/* ==================== CROP ==================== */
.crop-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 50vh;
  background: var(--surface-alt);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.crop-container canvas {
  width: 100%; height: 100%;
  object-fit: contain;
}
.crop-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}
.crop-rect {
  position: absolute;
  border: 2px solid var(--primary);
  background: rgba(232,146,124,.1);
  pointer-events: all;
  cursor: move;
}

.control-row {
  display: flex; gap: 8px; justify-content: center;
  margin-bottom: 16px;
}
.control-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.slider-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 8px;
}
.slider-label input[type="range"] { flex: 1; }
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 6px 0;
}
.toggle-label input { margin: 0; }

/* ==================== SETUP ==================== */
.method-select { display: flex; gap: 12px; margin-bottom: 8px; }
.method-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.method-btn.selected { border-color: var(--primary); background: rgba(232,146,124,.08); }
.method-icon { font-size: 28px; }
.method-label { font-size: 14px; font-weight: 600; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-row button {
  padding: 10px 16px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 14px;
}
.preset-row button:active { background: var(--primary-light); }

.size-inputs {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.size-inputs label { font-size: 14px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; flex: 1; }
.size-inputs input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  text-align: center;
}
.size-x { font-size: 20px; color: var(--text-muted); padding-top: 18px; }

.shape-select { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.shape-btn {
  padding: 12px 14px;
  min-height: 44px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
}
.shape-btn.selected { border-color: var(--primary); background: rgba(232,146,124,.08); }

.stretch-row {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
  margin: 8px 0 16px;
}
.stretch-row select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.preview-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  min-height: 150px;
}
.preview-box canvas { max-width: 100%; max-height: 200px; image-rendering: pixelated; }

/* ==================== PALETTE ==================== */
.palette-controls { margin-bottom: 16px; }
.palette-hint { margin-top: 4px; }

.palette-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.palette-entry {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.palette-swatch {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
}
.palette-symbol {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  border-radius: 4px;
  background: var(--surface-alt);
  flex-shrink: 0;
}
.palette-name-input {
  flex: 1;
  border: none; background: transparent;
  font-size: 14px;
  padding: 4px;
  min-width: 0;
}
.palette-name-input:focus { outline: none; border-bottom: 2px solid var(--primary); }
.palette-yarn-note {
  font-size: 12px; color: var(--text-muted);
  border: none; background: transparent;
  width: 100%;
  padding: 2px 4px;
}
.palette-pin {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  opacity: .4;
}
.palette-pin.pinned { opacity: 1; color: var(--primary); }

.palette-entry.merge-candidate { border-color: var(--primary); border-width: 2px; }

.palette-actions { display: flex; gap: 8px; justify-content: center; }

/* ==================== CHART ==================== */
.chart-toolbar {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.chart-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 55vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}
.chart-container canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.minimap {
  width: 80px; height: 80px;
  position: absolute;
  right: 8px; bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  opacity: .9;
}
.minimap canvas { width: 100%; height: 100%; }

/* ==================== TABS ==================== */
.view-tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabs-h);
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 90;
}
.tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  transition: color .15s;
}
.tab.active { color: var(--primary-dark); }
.tab:active { background: var(--surface-alt); }

/* ==================== INSTRUCTIONS ==================== */
.instructions-toolbar { margin-bottom: 12px; }
.mode-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mode-btn {
  flex: 1; padding: 10px;
  text-align: center;
  font-size: 14px; font-weight: 600;
  background: var(--surface);
}
.mode-btn.active { background: var(--primary); color: white; }

.instructions-list {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: calc(var(--tabs-h) + 20px);
}

.instruction-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.instruction-row-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.instruction-row-num {
  font-weight: 700; font-size: 16px;
  color: var(--primary-dark);
  min-width: 60px;
}
.instruction-phase {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-secondary);
}
.instruction-total {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}
.instruction-direction {
  font-size: 12px;
  color: var(--text-muted);
}

/* Row strip */
.row-strip {
  display: flex; height: 32px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.row-strip-run {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  border-right: 1px solid rgba(255,255,255,.3);
  min-width: 4px;
  overflow: hidden;
}
.row-strip-run:last-child { border-right: none; }

/* Token list */
.run-token-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 13px;
}
.run-token {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: var(--surface-alt);
  border-radius: 4px;
}
.run-token-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,.1);
}
.run-token-name { font-weight: 500; }
.run-token-count { font-weight: 700; color: var(--text); }

/* ==================== RUNNER ==================== */
.runner-header { margin-bottom: 16px; }

.progress-bar {
  height: 12px;
  background: var(--surface-alt);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .3s ease;
}

.runner-row-info {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px;
}
.row-num { font-weight: 700; font-size: 22px; color: var(--primary-dark); }
.row-phase {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
}
.row-total { margin-left: auto; color: var(--text-muted); font-size: 14px; }

.runner-strip {
  margin-bottom: 16px;
}
.runner-strip .row-strip { height: 48px; border-radius: var(--radius-sm); }
.runner-strip .row-strip-run { font-size: 14px; }
.runner-strip .row-strip-run.current {
  outline: 3px solid var(--text);
  outline-offset: -3px;
  z-index: 1;
}
.runner-strip .row-strip-run.completed { opacity: .4; }

.runner-run-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.runner-run-list .run-token { padding: 10px 14px; font-size: 16px; }
.runner-run-list .run-token.current {
  border: 2px solid var(--primary);
  background: rgba(232,146,124,.15);
}
.runner-run-list .run-token.completed {
  opacity: .4;
  text-decoration: line-through;
}

.runner-blocks {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 16px;
}
.runner-block {
  width: 36px; height: 36px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  cursor: pointer;
  border: 2px solid transparent;
  transition: opacity .15s, border-color .15s;
}
.runner-block.completed { opacity: .3; }
.runner-block.current { border-color: var(--text); }

.runner-controls {
  display: flex; gap: 8px;
  margin-bottom: 12px;
}
.ctrl-btn {
  flex: 1;
  padding: 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  text-align: center;
}
.ctrl-btn.btn-primary { border-color: var(--primary); background: var(--primary); color: white; }

.runner-extras {
  display: flex; gap: 16px; justify-content: center;
  padding-bottom: calc(var(--tabs-h) + 12px);
}

/* ==================== EXPORT ==================== */
.export-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.export-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 20px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.export-card:active { border-color: var(--primary); }
.export-icon { font-size: 32px; }
.export-card strong { font-size: 14px; }
.export-card small { font-size: 12px; color: var(--text-muted); text-align: center; }

.export-settings {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.export-settings h3 { font-size: 14px; margin-bottom: 12px; color: var(--text-secondary); }
.export-settings label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; margin-bottom: 8px;
}
.export-settings select {
  padding: 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* --- iOS keyboard overlap fix --- */
@supports (height: 100dvh) {
  .view-tabs { bottom: 0; }
  body.keyboard-open .view-tabs { position: absolute; }
}

/* --- Loading overlay --- */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(250,247,242,.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 250;
  gap: 12px;
}
.high-contrast .loading-overlay { background: rgba(26,26,26,.85); }
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--text-secondary); }

/* ==================== LOGIN ==================== */
.login-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  padding: 24px;
}
.login-icon { font-size: 72px; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); font-size: 16px; margin-bottom: 32px; }

.btn-google {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px; font-weight: 600;
  color: var(--text);
  transition: background .15s, box-shadow .15s;
  box-shadow: 0 1px 3px var(--shadow);
  min-height: 48px;
}
.btn-google:active { background: var(--surface-alt); }
.btn-google svg { flex-shrink: 0; }

.login-divider {
  display: flex; align-items: center; gap: 16px;
  width: 100%; max-width: 280px;
  margin: 20px 0;
  color: var(--text-muted); font-size: 13px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-local {
  width: 100%; max-width: 280px;
  text-align: center;
}

.login-benefits {
  margin-top: 32px;
  text-align: left;
  max-width: 280px;
}
.login-benefits ul {
  list-style: none; padding: 0; margin: 8px 0 0;
}
.login-benefits li {
  padding: 6px 0 6px 24px;
  position: relative;
  font-size: 14px; color: var(--text-secondary);
}
.login-benefits li::before {
  content: '\2713'; position: absolute; left: 0;
  color: var(--secondary); font-weight: 700;
}

/* ==================== ACCOUNT (header) ==================== */
.header-account {
  display: flex; align-items: center; justify-content: center;
}
.account-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.account-avatar.is-pro::after {
  content: 'PRO';
  position: absolute;
  bottom: -4px; right: -6px;
  font-size: 7px; font-weight: 800;
  background: var(--secondary);
  color: white;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
}

/* ==================== PRICING ==================== */
.pricing-header { text-align: center; margin-bottom: 24px; }
.pricing-header h2 { font-size: 22px; color: var(--primary-dark); }

.pricing-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.pricing-col {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}
.pricing-col h3 { font-size: 16px; margin-bottom: 8px; }
.pricing-price {
  font-size: 28px; font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}
.pricing-price span { font-size: 14px; font-weight: 400; color: var(--text-muted); }

.pricing-col ul { list-style: none; padding: 0; text-align: left; }
.pricing-col li {
  padding: 6px 0 6px 22px;
  font-size: 13px;
  position: relative;
}
.pricing-col li.has::before {
  content: '\2713'; position: absolute; left: 0;
  color: var(--secondary); font-weight: 700;
}
.pricing-col li.no {
  color: var(--text-muted);
  text-decoration: line-through;
}
.pricing-col li.no::before {
  content: '\2717'; position: absolute; left: 0;
  color: var(--text-muted);
}

.pricing-pro { border-color: var(--primary); }
.pricing-current {
  margin-top: 12px;
  padding: 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
}
.btn-subscribe {
  width: 100%;
  margin-top: 12px;
}

/* ==================== ACCOUNT (view) ==================== */
.account-user-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.account-user-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.account-user-name { font-size: 16px; font-weight: 600; }
.account-user-email { font-size: 13px; }

.account-plan-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.account-plan-label { font-size: 14px; color: var(--text-secondary); }
.account-plan-name {
  font-size: 16px; font-weight: 700;
  color: var(--text);
}
.account-plan-name.plan-pro { color: var(--secondary-dark); }
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  margin-left: auto;
}

.account-section {
  margin-bottom: 16px;
}
.account-action-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
  cursor: pointer;
}
.account-action-btn:active { background: var(--surface-alt); }
.account-action-danger { color: #c44; }
.btn-full-width { width: 100%; text-align: center; margin-top: 16px; }

/* ==================== UPGRADE MODAL ==================== */
.upgrade-modal { text-align: center; }
.upgrade-modal h3 { color: var(--primary-dark); }
.upgrade-modal-features {
  display: flex; flex-direction: column; gap: 8px;
  margin: 16px 0;
}
.upgrade-feature {
  padding: 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
}
.upgrade-feature::before {
  content: '\2713 ';
  color: var(--secondary); font-weight: 700;
}

/* ==================== PRO BADGE ON EXPORT ==================== */
.export-card .pro-badge {
  font-size: 10px; font-weight: 700;
  background: var(--secondary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* --- Media queries --- */
@media (min-width: 600px) {
  #app-main { max-width: 600px; margin: 0 auto; left: 0; right: 0; }
  .view-tabs { max-width: 600px; margin: 0 auto; left: 0; right: 0; }
}
