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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1f2428;
  --border: #30363d;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --error: #f85149;
  --error-bg: rgba(248, 81, 73, 0.1);
  --success: #3fb950;
  --success-bg: rgba(63, 185, 80, 0.1);
  --warning: #d29922;
  --warning-bg: rgba(210, 153, 34, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 2rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  text-align: left;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Auth Section */
.auth-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-github {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: #24292f;
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-github:hover {
  background: #32383f;
}

.btn-github svg {
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.btn-logout {
  padding: 0.375rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--error);
  border-color: var(--error);
}

#app {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.intro {
  margin-bottom: 1.5rem;
}

.description {
  margin-bottom: 1rem;
}

.privacy-notice,
.corporate-notice {
  font-size: 0.875rem;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.privacy-notice {
  color: var(--success);
  background: var(--success-bg);
  border-left: 3px solid var(--success);
}

.corporate-notice {
  color: var(--accent);
  background: rgba(88, 166, 255, 0.1);
  border-left: 3px solid var(--accent);
}

/* Upgrade Bar */
.upgrade-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.upgrade-bar-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pro-benefits {
  border-top: 1px solid rgba(210, 153, 34, 0.2);
  padding-top: 0.75rem;
}

.pro-benefits-title {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
}

.pro-benefits ul {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
}

.pro-benefits li {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pro-benefits li::before {
  content: '\2713 ';
  color: var(--success);
  font-weight: 700;
}

.plan-badge {
  padding: 0.125rem 0.5rem;
  background: var(--warning);
  color: var(--bg);
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upgrade-link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.upgrade-link:hover {
  background: rgba(88, 166, 255, 0.1);
}

.upgrade-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.buy-section {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cpf-input {
  width: 130px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

/* Flow Sections */
.flow-section {
  margin-top: 1.5rem;
}

.flow-section h2 {
  margin-bottom: 0.5rem;
}

.flow-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.manual-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.git-command {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.git-command code {
  flex: 1;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--accent);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fallback-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.fallback-link a {
  color: var(--text-muted);
  text-decoration: none;
}

.fallback-link a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Repos List */
.repos-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 1rem;
}

.repo-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.repo-item:last-child {
  border-bottom: none;
}

.repo-item:hover {
  background: var(--surface-hover);
}

.repo-item input[type="checkbox"] {
  margin-right: 0.75rem;
  accent-color: var(--accent);
}

.repo-item label {
  flex: 1;
  margin: 0;
  cursor: pointer;
}

.repo-name {
  font-weight: 500;
}

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

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.repo-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.repo-private {
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.privacy-notice strong,
.corporate-notice strong {
  display: block;
  margin-bottom: 0.25rem;
}

.email-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.footer-privacy {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mode-option {
  flex: 1;
  cursor: pointer;
  margin: 0;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
  text-align: center;
}

.mode-card:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.mode-option.selected .mode-card {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.05);
}

.mode-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.mode-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

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

/* Form Styles */
.form-section {
  margin-bottom: 1rem;
}

.form-section.half {
  flex: 1;
}

.form-row {
  display: flex;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

textarea,
input[type="text"],
input[type="email"],
input[type="date"] {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
}

textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-upload {
  cursor: pointer;
  color: var(--accent);
}

.file-upload:hover {
  color: var(--accent-hover);
}

.file-upload input[type="file"] {
  display: none;
}

.date-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* Button */
button[type="submit"] {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button[type="submit"]:hover:not(:disabled) {
  background: var(--accent-hover);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Messages */
.error,
.warnings {
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.error {
  background: var(--error-bg);
  border-left: 3px solid var(--error);
  color: var(--error);
}

.warnings {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  color: var(--warning);
}

.hidden {
  display: none !important;
}

/* Result Section */
#result {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

#copy-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

#copy-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

#result-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.8;
}

#result-content h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

#result-content h2 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

#result-content p {
  margin-bottom: 1rem;
}

#result-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

#result-content li {
  margin-bottom: 0.5rem;
}

/* Result Upsell */
.result-upsell {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(88, 166, 255, 0.06);
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: 6px;
  text-align: center;
}

.result-upsell p {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.result-upsell p:first-child {
  color: var(--text);
}

.result-upsell .upgrade-link {
  margin-left: 0;
  margin-top: 0.5rem;
}

/* Landing Page */
.landing {
  text-align: center;
}

.hero {
  padding: 3rem 0 2rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
}

.hero-slash {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero-modes {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.hero-mode {
  flex: 1;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
}

.hero-mode-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.hero-mode strong {
  font-size: 1rem;
  color: var(--text);
}

.hero-mode span:last-child {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-github-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2.5rem;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-github-hero:hover {
  background: #e6e6e6;
  transform: translateY(-1px);
}

.btn-github-hero svg {
  flex-shrink: 0;
}

.hero-hint {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* How It Works */
.how-it-works {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.how-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  text-align: left;
}

.step {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.step-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

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

/* Trust Bar */
.trust-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.trust-icon {
  font-size: 1rem;
}

/* Footer */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer .disclaimer {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 600px) {
  main {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .brand {
    text-align: center;
  }

  h1 {
    font-size: 1.75rem;
  }

  .mode-selector {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .input-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .git-command {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .hero-title {
    font-size: 2.25rem;
  }

  .hero-modes {
    flex-direction: column;
    align-items: center;
  }

  .hero-mode {
    max-width: 100%;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .trust-bar {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
}
