/* ═══════════════════════════════════════════════════════════════════════════
   Normalize Post — Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:         #0a0a0f;
  --bg-2:       #13131a;
  --bg-3:       #1a1a24;
  --border:     #2a2a38;
  --text:       #e4e4ea;
  --text-dim:   #9494a8;
  --accent:     #6b7aff;
  --accent-dim: #4a5acc;
  --danger:     #ff5656;
  --success:    #4ade80;
  --warning:    #fbbf24;
  --pro:        #f59e0b;
  --shadow-sm:        rgba(0,0,0,0.40);
  --shadow-lg:        rgba(0,0,0,0.60);
  --overlay:          rgba(0,0,0,0.80);
  --warning-tint:     rgba(251,191,36,0.10);
  --warning-tint-bd:  rgba(251,191,36,0.30);
  --success-tint:     rgba(74,222,128,0.10);
  --success-tint-bd:  rgba(74,222,128,0.25);
  --accent-tint:      rgba(107,122,255,0.15);
  --accent-tint-bd:   rgba(107,122,255,0.30);
}

[data-theme="light"] {
  --bg:         #f0f0f5;
  --bg-2:       #ffffff;
  --bg-3:       #e8e8f0;
  --border:     #c8c8d8;
  --text:       #16162a;
  --text-dim:   #52527a;
  --accent:     #4a5acc;
  --accent-dim: #3a47b0;
  --danger:     #d93030;
  --success:    #1a9e50;
  --warning:    #c07a00;
  --pro:        #b06000;
  --shadow-sm:        rgba(0,0,0,0.12);
  --shadow-lg:        rgba(0,0,0,0.20);
  --overlay:          rgba(0,0,0,0.50);
  --warning-tint:     rgba(192,122,0,0.10);
  --warning-tint-bd:  rgba(192,122,0,0.30);
  --success-tint:     rgba(26,158,80,0.10);
  --success-tint-bd:  rgba(26,158,80,0.25);
  --accent-tint:      rgba(74,87,204,0.12);
  --accent-tint-bd:   rgba(74,87,204,0.30);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

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

.wordmark {
  text-decoration: none;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), #9d6bff);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 14px var(--accent-glow);
  flex-shrink: 0;
}

.wordmark em {
  font-style: normal;
  color: var(--accent);
}

.sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
}

.page-title-logo {
  display: block;
  height: 24px;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.btn-theme-toggle:hover {
  background: var(--border);
  border-color: var(--accent-dim);
}

/* Show sun icon in dark mode, moon icon in light mode */
.theme-icon-dark { display: inline; }
.theme-icon-light { display: none; }

[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

.user-name {
  font-size: 14px;
  color: var(--text-dim);
  padding: 0 8px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-app {
  padding: 8px 16px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

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

.btn-logout {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-logout:hover {
  background: var(--bg-3);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 18px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Info Panel ──────────────────────────────────────────────────────────── */
.info-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

.info-panel h2 {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.info-panel > p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 24px;
}

.features-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.feature-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.feature-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.pro-badge {
  background: linear-gradient(135deg, var(--pro), var(--warning));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 20px;
}

.feature-item strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.feature-item p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Examples section */
.examples-section {
  margin-top: 24px;
}

.examples-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.example-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.example-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.example-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
}

/* ── Editor Panel ────────────────────────────────────────────────────────── */
.editor-panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
  gap: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn-tool {
  padding: 8px 14px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.toolbar-spacer {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Detection Message ───────────────────────────────────────────────────── */
.detection-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

.detection-message.ai-detected {
  background: var(--warning-tint);
  border-color: var(--warning);
  color: var(--warning);
}

.detection-message.no-ai {
  background: var(--success-tint);
  border-color: var(--success);
  color: var(--success);
}

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

.detection-icon {
  font-size: 20px;
}

.char-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.6;
  white-space: nowrap;
}

.char-count--over {
  opacity: 1;
  color: var(--warning);
  font-weight: 600;
}

/* ── Editor Container ────────────────────────────────────────────────────── */
.editor-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-height: 400px;
}

.editor-container.split {
  grid-template-columns: 1fr 1fr;
}

.textarea-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
}

#input-text {
  width: 100%;
  height: 100%;
  min-height: 400px;
  padding: 16px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.2s;
}

#input-text:focus {
  outline: none;
  border-color: var(--accent);
}

#input-text::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Preview wrapper */
.preview-wrapper {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}

.btn-preview-close {
  padding: 4px 8px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preview-close:hover {
  background: var(--bg);
  color: var(--text);
}

.preview-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

/* Markdown preview styles */
.preview-content h1,
.preview-content h2,
.preview-content h3 {
  font-family: 'Syne', sans-serif;
  margin: 16px 0 8px;
  color: var(--text);
}

.preview-content h1 { font-size: 24px; }
.preview-content h2 { font-size: 20px; }
.preview-content h3 { font-size: 18px; }

.preview-content p {
  margin: 8px 0;
}

.preview-content code {
  padding: 2px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
}

.preview-content pre {
  padding: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
}

.preview-content pre code {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
}

.preview-content ul,
.preview-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.preview-content li {
  margin: 4px 0;
}

/* ── Action Buttons ──────────────────────────────────────────────────────── */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.usage-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-copy {
  background: var(--success);
  color: white;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-copy:hover {
  background: var(--success);
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-copy.copied {
  background: #22c55e;
  transform: scale(1.07);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

@keyframes copy-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0); }
}

.btn-copy.copied {
  animation: copy-pulse 0.5s ease-out;
}

.btn-clear {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-clear:hover {
  background: var(--bg-3);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px var(--shadow-sm);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

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

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  position: relative;
  max-width: 440px;
  width: 90%;
  padding: 32px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-3);
  color: var(--text);
}

.modal-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 16px;
}

.modal h2 {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text);
}

.modal p {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#google-signin-button {
  display: flex;
  justify-content: center;
  margin: 0 0 8px;
}

/* ── Auth email/password form ─────────────────────────────────────────���─── */
.auth-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.auth-input:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-submit-btn {
  width: 100%;
  margin-bottom: 10px;
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 4px;
}
.auth-switch a:hover { text-decoration: underline; }
.auth-error {
  font-size: 13px;
  color: #f87171;
  margin-bottom: 8px;
  text-align: center;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ── Pricing Section ─────────────────────────────────────────────────────────*/
.normalize-section,
.pricing-section {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 20px;
  margin: 0;
  border: 1px solid var(--border);
}

.normalize-section h2,
.pricing-section h2 {
  font-family: 'Syne', sans-serif;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 24px;
}

.normalize-section p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

.pricing-section h2 {
  color: var(--text);
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-3);
  border-radius: 12px;
  padding: 30px;
  border: 2px solid var(--border);
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-dim);
}

.pricing-card.pro-card {
  border-color: var(--accent);
}

.pricing-card h3 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--text);
}

.price {
  font-size: 36px;
  font-weight: bold;
  color: var(--accent);
  margin: 15px 0;
}

.price span {
  font-size: 16px;
  font-weight: normal;
  color: var(--text-dim);
}

.monthly-equivalent {
  font-size: 14px;
  color: var(--success);
  margin: -10px 0 15px;
  font-weight: bold;
}

.features {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text);
}

.btn-upgrade {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-upgrade:hover {
  background: var(--accent-dim);
}

.btn-upgrade.yearly {
  background: var(--success);
}

.btn-upgrade.yearly:hover {
  background: var(--success);
  filter: brightness(1.1);
}

.btn-free {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: not-allowed;
}

.popular-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.savings-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.usage-counter {
  margin-top: 15px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
}

.usage-counter span {
  font-weight: bold;
  color: var(--accent);
}

/* ── Usage Bar ───────────────────────────────────────────────────────────────*/
.usage-bar-container {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 15px 20px;
  margin: 20px;
  border: 1px solid var(--border);
}

.usage-label {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.usage-label span {
  font-weight: bold;
  color: var(--text);
}

.usage-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.3s ease;
}

.usage-message {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.usage-warning {
  color: var(--danger);
  font-weight: bold;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .editor-container.split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .main { padding: 16px; }
}

@media (max-width: 600px) {
  .header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 10px 14px;
    gap: 0;
  }

  .header-left {
    flex-shrink: 1;
    min-width: 0;
    gap: 10px;
  }

  .header-right {
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: 8px;
    margin-left: auto;
  }

  .plan-badge {
    font-size: 11px;
    padding: 2px 8px;
  }

  .btn-upgrade-sm {
    font-size: 11px;
    padding: 4px 10px;
    white-space: nowrap;
  }

  .page-title {
    font-size: 14px;
  }

  .main {
    padding: 12px;
    gap: 12px;
  }

  .editor-panel {
    padding: 14px;
    gap: 12px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
    padding: 10px;
  }

  .toolbar-spacer {
    display: none;
  }

  .btn-tool,
  .checkbox-label {
    width: 100%;
  }

  .checkbox-label {
    justify-content: flex-start;
  }

  .editor-container {
    min-height: auto;
    gap: 12px;
  }

  #input-text {
    min-height: 240px;
    font-size: 16px;
    padding: 14px;
  }

  .preview-wrapper {
    min-height: 220px;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .action-buttons .btn,
  .action-buttons .btn-tool {
    width: 100%;
  }

  .usage-count {
    width: auto;
    align-self: flex-start;
  }

  .info-panel,
  .pricing-section {
    border-radius: 10px;
  }

  .pricing-section {
    padding: 16px 12px;
  }

  .pricing-cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pricing-card {
    padding: 20px;
  }

  .pricing-card h3 {
    font-size: 20px;
  }

  .price {
    font-size: 30px;
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px 18px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn,
  .modal-actions a {
    width: 100%;
    text-align: center;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 420px) {
  .wordmark {
    font-size: 18px;
  }

  .page-title {
    font-size: 13px;
  }

  .btn,
  .btn-app,
  .btn-tool {
    font-size: 13px;
  }
}

/* ── PayPro subscription additions ──────────────────────────────────────── */

/* Header user info */
.user-email {
  font-size: 13px;
  color: var(--text-dim);
}

/* Plan badge in header */
.plan-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.plan-badge.badge-free {
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.plan-badge.badge-paid {
  background: var(--accent-tint);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

/* Small upgrade button in header */
.btn-upgrade-sm {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-upgrade-sm:hover { background: var(--accent-dim); }

.btn-signout {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-signout:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* Free card in pricing section */
.pricing-card.free-card {
  border-color: var(--border);
  opacity: 0.8;
}
.pricing-badge {
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.current-plan-label {
  margin-top: 16px;
  padding: 8px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Pricing modal ───────────────────────────────────────────────────────── */
.modal-pricing {
  max-width: 520px;
}

.pricing-modal-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0 18px;
}

.pricing-modal-card {
  background: var(--bg-3);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, transform 0.15s;
  text-align: center;
}
.pricing-modal-card:hover,
.pricing-modal-card.selected {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.pricing-modal-card.pm-featured {
  border-color: var(--accent-dim);
}
.pm-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pm-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.pm-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.pm-price span {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 400;
}
.pm-note {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

.pricing-modal-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.pmf-item {
  font-size: 13px;
  color: var(--success);
}

.modal-secure-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Files Panel ─────────────────────────────────────────────────────────── */
.files-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.files-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.files-panel-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.files-count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
}

.files-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(3 * 48px + 41px); /* 3 rows + thead */
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.files-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-2);
  text-align: left;
  padding: 8px 12px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.files-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.files-table tbody tr:last-child {
  border-bottom: none;
}

.files-table tbody tr:hover {
  background: var(--bg-3);
}

.files-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── File badges ─────────────────────────────────────────────────────────── */
.file-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.file-badge-ai {
  background: var(--warning-tint);
  color: var(--warning);
  border: 1px solid var(--warning-tint-bd);
}

.file-badge-clean {
  background: var(--success-tint);
  color: var(--success);
  border: 1px solid var(--success-tint-bd);
}

.file-badge-done {
  background: var(--accent-tint);
  color: var(--accent);
  border: 1px solid var(--accent-tint-bd);
}

.file-badge-raw {
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ── File action buttons ─────────────────────────────────────────────────── */
.file-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.btn-file-action {
  padding: 4px 10px;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-file-action:hover {
  background: var(--border);
  color: var(--text);
}

.btn-file-clean:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.btn-file-dl:hover {
  border-color: var(--success);
  color: var(--success);
}

.btn-file-del:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.files-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 0;
}

/* ── Style Selector ──────────────────────────────────────────────────────── */
.style-selector-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.style-selector-label {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  user-select: none;
}

.style-select {
  height: 32px;
  padding: 0 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
  outline: none;
}

.style-select:hover {
  border-color: var(--accent-dim, var(--accent));
}

.style-select:focus {
  border-color: var(--accent);
}

.style-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Token Limit Banner ──────────────────────────────────────────────────── */
.token-limit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--warning) 12%, var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  flex-wrap: wrap;
}

.token-upgrade-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Token Status Indicator ──────────────────────────────────────────────── */
.token-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  gap: 4px;
}

.token-status.near-limit {
  border-color: color-mix(in srgb, var(--warning) 50%, transparent);
  color: var(--warning);
}

.token-status.at-limit {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  color: var(--danger);
}

@media (max-width: 600px) {
  .style-selector-wrap {
    width: 100%;
  }

  .style-select {
    flex: 1;
  }

  .token-limit-banner {
    font-size: 12px;
  }
}

