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

    body {
      font-family: var(--font-body), system-ui, sans-serif;
      background: var(--bg-base);
      color: var(--text);
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
    }

    /* ── Header ── */
    .header {
      background: var(--bg-card);
      border-bottom: 1px solid var(--border-glass);
      padding: 14px 22px;
      display: flex;
      align-items: center;
      gap: 12px;
      position: sticky;
      top: 0;
      z-index: 100;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }

    .header a.back {
      color: var(--text-muted);
      text-decoration: none;
      font-size: 0.85rem;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: color 0.15s;
    }

    .header a.back:hover {
      color: var(--text);
    }

    .header h1 {
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--text);
      flex: 1;
    }

    .header-badge {
      background: var(--brand-light);
      color: var(--brand);
      border: 1px solid rgba(255, 107, 0, 0.25);
      font-size: 0.68rem;
      font-weight: 700;
      padding: 3px 10px;
      border-radius: 20px;
      letter-spacing: 0.5px;
    }

    .header-agenda-link {
      text-decoration: none;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
      background: var(--bg-raised);
      border: 1px solid var(--border-glass);
      padding: 5px 12px;
      border-radius: 20px;
      transition: color 0.15s, border-color 0.15s;
      white-space: nowrap;
    }

    .header-agenda-link:hover {
      color: var(--text);
      border-color: var(--text-muted);
    }

    /* ── Main container ── */
    .container {
      max-width: 960px;
      margin: 0 auto;
      padding: 30px 16px 64px;
      display: flex;
      flex-direction: column;
      gap: 24px;
    }

    /* ── Buttons ── */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 48px;
      /* Accessible target */
      border-radius: var(--radius-sm);
      padding: 11px 20px;
      font-size: 0.95rem;
      font-weight: 600;
      line-height: 1;
      cursor: pointer;
      font-family: inherit;
      border: 1px solid transparent;
      transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition), opacity var(--transition);
      white-space: nowrap;
      text-decoration: none;
    }

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

    .btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .btn-primary {
      color: #fff;
      background: linear-gradient(135deg, var(--brand), var(--brand-end));
      box-shadow: var(--shadow-brand);
      border: none;
    }

    .btn-primary:hover {
      box-shadow: 0 6px 20px rgba(255, 106, 0, 0.4);
      opacity: 0.95;
    }

    .btn-secondary {
      color: var(--text-muted);
      background: transparent;
      border: 1px solid var(--border-glass);
    }

    .btn-secondary:hover {
      color: var(--text);
      background: var(--bg-raised);
      border-color: var(--text-muted);
    }

    .btn-ghost {
      color: #7EB4FF;
      background: rgba(59, 130, 246, 0.08);
      border-color: rgba(59, 130, 246, 0.25);
    }

    .btn-ghost:hover {
      background: rgba(59, 130, 246, 0.14);
      border-color: rgba(59, 130, 246, 0.38);
    }

    .btn-success {
      color: #fff;
      background: linear-gradient(120deg, #22C55E, #16A34A);
      box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
    }

    .btn-success:hover {
      box-shadow: 0 8px 24px rgba(34, 197, 94, 0.36);
    }

    /* ── Input section ── */
    .input-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 24px;
      border: 1px solid var(--border-glass);
      box-shadow: var(--shadow-card);
    }

    .input-card h2 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 6px;
      font-family: var(--font-display);
    }

    .input-card p {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 20px;
    }

    .platform-icons {
      display: flex;
      gap: 8px;
      margin-bottom: 18px;
      flex-wrap: wrap;
    }

    .platform-pill {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 14px;
      border-radius: 20px;
      font-size: 0.78rem;
      font-weight: 600;
      border: 1px solid transparent;
    }

    .platform-pill.shopee {
      background: rgba(238, 77, 45, 0.1);
      color: #ff5722;
      border-color: rgba(238, 77, 45, 0.2);
    }

    html[data-theme="dark"] .platform-pill.shopee {
      color: #ff8a65;
    }

    .platform-pill.ml {
      background: rgba(52, 131, 250, 0.1);
      color: #0066ff;
      border-color: rgba(52, 131, 250, 0.2);
    }

    html[data-theme="dark"] .platform-pill.ml {
      color: #5aa1ff;
    }

    .platform-pill.amazon {
      background: rgba(255, 153, 0, 0.1);
      color: #cc7a00;
      border-color: rgba(255, 153, 0, 0.2);
    }

    html[data-theme="dark"] .platform-pill.amazon {
      color: #ffaf33;
    }

    .platform-pill.magalu {
      background: rgba(0, 134, 255, 0.1);
      color: #006bcf;
      border-color: rgba(0, 134, 255, 0.2);
    }

    html[data-theme="dark"] .platform-pill.magalu {
      color: #4aaaff;
    }

    .input-row {
      display: flex;
      gap: 12px;
      align-items: center;
    }

    .url-input {
      flex: 1;
      padding: 12px 16px;
      border: 1px solid var(--border-glass);
      border-radius: var(--radius-sm);
      font-size: 0.95rem;
      font-family: var(--font-body);
      color: var(--text);
      background: var(--bg-input);
      transition: border-color var(--transition), box-shadow var(--transition);
    }

    .url-input:focus {
      outline: none;
      border-color: var(--brand);
      box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
    }

    .url-input::placeholder {
      color: var(--text-muted);
    }

    .btn-analyze {
      min-width: 140px;
    }

    /* ── Loading state ── */
    .loading-state {
      display: none;
      text-align: center;
      padding: 40px 20px;
    }

    .loading-state.visible {
      display: block;
    }

    .spinner {
      width: 40px;
      height: 40px;
      border: 3px solid var(--bg-raised);
      border-top-color: var(--brand);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin: 0 auto 12px;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .loading-state p {
      color: var(--text-muted);
      font-size: 0.9rem;
    }

    /* ── Error message ── */
    .error-msg {
      display: none;
      background: rgba(239, 68, 68, 0.10);
      color: #F87171;
      border: 1px solid rgba(239, 68, 68, 0.25);
      border-left: 3px solid #EF4444;
      border-radius: 8px;
      padding: 12px 16px;
      font-size: 0.85rem;
      margin-top: 12px;
    }

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

    /* ── Result section ── */
    .result-section {
      display: none;
    }

    .result-section.visible {
      display: block;
    }

    /* ── Product info card ── */
    .result-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 24px;
    }

    @media (max-width: 680px) {
      .result-grid {
        grid-template-columns: 1fr;
      }

      .input-row {
        flex-direction: column;
      }
    }

    .product-info-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 20px;
      border: 1px solid var(--border);
    }

    .product-info-card h3 {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .product-image-wrap {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 10px;
      overflow: hidden;
      background: var(--bg-raised);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 14px;
    }

    .product-image-wrap img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .product-image-placeholder {
      font-size: 48px;
      opacity: 0.25;
    }

    .product-platform-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 10px;
      border-radius: 20px;
      font-size: 0.72rem;
      font-weight: 700;
      color: white;
      margin-bottom: 8px;
    }

    .product-title {
      font-size: 1.05rem;
      font-weight: 600;
      color: var(--text);
      line-height: 1.4;
      margin-bottom: 16px;
      /* Truncate to 2 lines */
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    [contenteditable="true"]:hover,
    [contenteditable="true"]:focus {
      outline: 1px dashed var(--border-glass);
      border-radius: 4px;
      padding: 1px 4px;
      cursor: text;
    }

    .product-price-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .price-original {
      font-size: 0.8rem;
      color: var(--text-muted);
      text-decoration: line-through;
    }

    .price-current {
      font-size: 1.3rem;
      font-weight: 800;
      color: var(--brand);
    }

    .price-discount {
      background: rgba(239, 68, 68, 0.15);
      color: #F87171;
      border: 1px solid rgba(239, 68, 68, 0.25);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 4px;
    }

    /* ── Affiliate link card ── */
    .affiliate-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 20px;
      border: 1px solid var(--border);
    }

    .affiliate-card h3 {
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 14px;
    }

    .credential-warning {
      display: none;
      background: rgba(245, 158, 11, 0.10);
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-left: 3px solid #F59E0B;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 0.8rem;
      color: #FCD34D;
      margin-bottom: 14px;
    }

    .credential-warning.visible {
      display: block;
    }

    .credential-warning.expired {
      background: rgba(239, 68, 68, 0.10);
      border-color: rgba(239, 68, 68, 0.25);
      border-left-color: #EF4444;
      color: #FCA5A5;
    }

    .affiliate-link-box {
      background: var(--bg-input);
      border: 1px solid var(--border-glass);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      font-size: 0.85rem;
      color: var(--text-muted);
      word-break: break-all;
      font-family: monospace;
      margin-bottom: 16px;
      max-height: 80px;
      overflow-y: auto;
    }

    .link-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .btn-action {
      min-height: 38px;
      padding: 9px 14px;
      border-radius: 9px;
      font-size: 0.8rem;
      font-weight: 700;
    }

    .btn-copy-link {
      min-width: 124px;
    }

    .btn-open-link {
      min-width: 96px;
    }

    /* ── Card generator section ── */
    .card-generator {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 24px;
      border: 1px solid var(--border);
    }

    .card-generator h3 {
      font-size: 1rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .card-generator>p {
      font-size: 0.82rem;
      color: var(--text-muted);
      margin-bottom: 20px;
    }

    .card-preview-area {
      display: flex;
      gap: 20px;
      flex-wrap: wrap;
    }

    .canvas-wrap {
      flex: 0 0 auto;
    }

    .canvas-wrap canvas {
      display: block;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-glass);
      box-shadow: var(--shadow-sm);
      max-width: 100%;
      width: 320px;
      height: auto;
      /* Fixes vertical compression */
      background: var(--bg-card);
    }

    .card-controls {
      flex: 1;
      min-width: 220px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      justify-content: center;
    }

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

    /* ── Template picker ── */
    .template-picker {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }

    .tpl-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 6px 6px 4px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg-raised);
      cursor: pointer;
      transition: all 0.15s;
      font-family: inherit;
    }

    .tpl-btn:hover {
      border-color: var(--border-glass);
    }

    .tpl-btn.active {
      border-color: var(--brand);
      background: rgba(255, 107, 0, 0.10);
    }

    .tpl-btn span {
      font-size: 0.65rem;
      font-weight: 600;
      color: var(--text-muted);
    }

    .tpl-btn.active span {
      color: var(--brand);
    }

    .tpl-thumb {
      width: 44px;
      height: 44px;
      border-radius: 5px;
      overflow: hidden;
      position: relative;
      flex-shrink: 0;
    }

    /* Padrão */
    .tpl-padrao {
      background: var(--bg-raised);
      border: 1px solid var(--border);
    }

    .tpl-padrao::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 7px;
      background: linear-gradient(90deg, #FF6B00, #EE4D2D);
    }

    .tpl-padrao::after {
      content: '';
      position: absolute;
      top: 11px;
      left: 6px;
      right: 6px;
      height: 17px;
      background: var(--border);
      border-radius: 2px;
    }

    /* Destaque */
    .tpl-destaque {
      background: var(--bg-raised);
      border: 1px solid var(--border);
    }

    .tpl-destaque::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 22px;
      background: #EE4D2D;
    }

    .tpl-destaque::after {
      content: '';
      position: absolute;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      width: 20px;
      height: 20px;
      background: var(--bg-raised);
      border-radius: 3px;
      box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
    }

    /* Promo */
    .tpl-promo {
      background: var(--bg-card);
      border: 1px solid var(--border);
    }

    .tpl-promo::before {
      content: '';
      position: absolute;
      top: 6px;
      left: 6px;
      right: 6px;
      height: 18px;
      background: var(--bg-hover);
      border-radius: 2px;
    }

    .tpl-promo::after {
      content: '';
      position: absolute;
      bottom: 5px;
      left: 6px;
      right: 6px;
      height: 10px;
      background: #FF6B00;
      border-radius: 2px;
    }

    /* Minimal */
    .tpl-minimal {
      background: var(--bg-raised);
      border: 1px solid var(--border);
      overflow: hidden;
    }

    .tpl-minimal::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 30px;
      background: var(--bg-hover);
    }

    .tpl-minimal::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 14px;
      background: linear-gradient(90deg, #FF6B00, #EE4D2D);
    }

    /* Personalizado */
    .tpl-personalizado {
      background: linear-gradient(135deg, #3730A3, #7C3AED);
      border: 1px solid rgba(124, 58, 237, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      line-height: 1;
    }

    /* Custom template upload */
    .custom-tpl-area {
      display: none;
      margin-top: 8px;
    }

    .btn-upload-tpl {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 6px 12px;
      border: 1.5px dashed var(--border);
      border-radius: 8px;
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--text-muted);
      cursor: pointer;
      background: var(--bg-raised);
      transition: all 0.15s;
    }

    .btn-upload-tpl:hover {
      border-color: var(--brand);
      color: var(--brand);
      background: rgba(255, 107, 0, 0.06);
    }

    .custom-tpl-info {
      font-size: 0.7rem;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .custom-tpl-preview {
      width: 44px;
      height: 44px;
      border-radius: 5px;
      object-fit: cover;
      border: 1px solid var(--border);
      display: none;
      margin-top: 4px;
    }

    .card-cta-group {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .btn-generate {
      width: 100%;
      min-height: 44px;
    }

    .btn-download {
      width: 100%;
      min-height: 44px;
      display: none;
      text-decoration: none;
    }

    .btn-download.visible {
      display: flex;
    }

    .btn-download:hover {
      text-decoration: none;
    }

    .card-hint {
      font-size: 0.75rem;
      color: var(--text-muted);
      line-height: 1.5;
    }

    /* ── Hidden canvas for full-res export ── */
    #export-canvas {
      display: none;
    }

    /* ── Empty state ── */
    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: var(--text-muted);
    }

    .empty-state .empty-icon {
      font-size: 64px;
      margin-bottom: 16px;
      opacity: 0.35;
    }

    .empty-state h2 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 8px;
    }

    .empty-state p {
      font-size: 0.85rem;
      max-width: 320px;
      margin: 0 auto;
    }

    /* === Seção de Publicação WhatsApp === */
    .publish-section {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 24px;
      margin: 24px auto 0;
      max-width: 900px;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-group label {
      display: block;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 8px;
    }

    .textarea-custom {
      width: 100%;
      height: 140px;
      padding: 14px 16px;
      border: 1px solid var(--border-glass);
      border-radius: var(--radius-sm);
      font-size: 0.95rem;
      font-family: inherit;
      resize: vertical;
      color: var(--text);
      background: var(--bg-input);
      transition: border-color var(--transition), box-shadow var(--transition);
    }

    .textarea-custom:focus {
      outline: none;
      border-color: var(--brand);
      box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
    }

    .group-select {
      width: 100%;
      padding: 14px 16px;
      border: 1px solid var(--border-glass);
      border-radius: var(--radius-sm);
      font-size: 0.95rem;
      font-family: inherit;
      color: var(--text);
      background: var(--bg-input);
      cursor: pointer;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 16px center;
      transition: border-color var(--transition);
    }

    .group-select:focus {
      outline: none;
      border-color: var(--brand);
      box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
    }

    /* ── Action bar na Publish Section ── */
    .publish-action-bar {
      display: flex;
      gap: 12px;
      align-items: center;
      margin-top: 10px;
    }

    @media (max-width: 600px) {
      .publish-action-bar {
        flex-direction: column;
        align-items: stretch;
      }

      .publish-action-bar .btn {
        width: 100%;
      }
    }

    .publish-title {
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--text);
      margin: 0 0 20px;
    }

    .publish-row {
      margin-bottom: 16px;
    }

    .publish-label {
      display: block;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .publish-select {
      width: 100%;
      padding: 10px 12px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      font-size: 0.92rem;
      background: var(--bg-input);
      color: var(--text);
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A7B0CB' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      cursor: pointer;
      transition: border-color 0.15s;
    }

    .publish-select:focus {
      outline: none;
      border-color: var(--brand);
    }

    .publish-caption {
      width: 100%;
      padding: 10px 12px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      font-size: 0.92rem;
      font-family: inherit;
      resize: vertical;
      min-height: 80px;
      box-sizing: border-box;
      background: var(--bg-input);
      color: var(--text);
      line-height: 1.5;
      transition: border-color 0.15s;
    }

    .publish-caption::placeholder {
      color: var(--text-muted);
    }

    .publish-caption:focus {
      outline: none;
      border-color: var(--brand);
    }

    .publish-time-row {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }

    .publish-radio-label {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.92rem;
      color: var(--text-muted);
      cursor: pointer;
      font-weight: 500;
    }

    .publish-radio-label input[type="radio"] {
      accent-color: var(--brand);
      cursor: pointer;
    }

    .publish-datetime {
      padding: 8px 12px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      font-size: 0.9rem;
      color: var(--text);
      background: var(--bg-input);
      flex: 1;
      min-width: 180px;
      transition: border-color 0.15s;
      color-scheme: dark;
    }

    .publish-datetime:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }

    .publish-datetime:focus {
      outline: none;
      border-color: var(--brand);
    }

    .btn-publish {
      border-radius: 12px;
      width: 100%;
      min-height: 46px;
    }

    .btn-publish:hover:not(:disabled) {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .btn-publish:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .publish-feedback {
      margin-top: 12px;
      padding: 12px 16px;
      border-radius: 10px;
      font-size: 0.9rem;
      font-weight: 600;
      text-align: center;
    }

    .publish-feedback.success {
      background: rgba(34, 197, 94, 0.12);
      color: #4ADE80;
      border: 1px solid rgba(34, 197, 94, 0.25);
    }

    .publish-feedback.error {
      background: rgba(239, 68, 68, 0.10);
      color: #F87171;
      border: 1px solid rgba(239, 68, 68, 0.25);
    }