/* kthx Styles */
:root {
  --primary: #4285f4;
  --primary-dark: #3367d6;
  --danger: #ea4335;
  --success: #34a853;
  --warn: #fbbc05;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ============================================
   Landing page
   ============================================ */

.landing-page {
  background: var(--surface);
}

.landing-nav {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.landing-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
}

/* Hero */
.hero {
  text-align: center;
  padding: 80px 24px 64px;
  max-width: 640px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* How it works */
.how-it-works {
  padding: 64px 24px;
  background: var(--bg);
}

.how-it-works h2,
.features h2,
.pricing-section h2 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 40px;
}

.steps {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.step {
  text-align: center;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.step h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.step p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Features grid */
.features {
  padding: 64px 24px;
}

.feature-grid {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.feature-card h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Pricing section (landing) */
.pricing-section {
  padding: 64px 24px;
  background: var(--bg);
}

.pricing-card-landing {
  max-width: 400px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(66,133,244,0.12);
}

.pricing-amount {
  font-size: 48px;
  font-weight: 700;
}

.pricing-amount span {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-secondary);
}

.pricing-annual {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}

.pricing-features li {
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.pricing-features li::before {
  content: "\2713 ";
  color: var(--success);
  font-weight: 700;
  margin-right: 8px;
}

/* Pricing page */
.pricing-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px;
}

.pricing-page h1 {
  text-align: center;
  font-size: 36px;
  margin-bottom: 8px;
}

.pricing-page-sub {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.pricing-card-large {
  margin-bottom: 32px;
}

.addon-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 48px;
}

.addon-card h3 {
  margin-bottom: 4px;
}

.addon-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.faq {
  margin-bottom: 48px;
}

.faq h2 {
  font-size: 24px;
  margin-bottom: 24px;
}

.faq-item {
  margin-bottom: 20px;
}

.faq-item h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.faq-item p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Footer */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-weight: 700;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.footer-links a:hover {
  color: var(--text);
}

/* Legal pages */
.legal-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px;
}

.legal-page h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 8px;
}

.legal-page p,
.legal-page ul {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.legal-page ul {
  padding-left: 20px;
}

.legal-page a {
  color: var(--primary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

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

.btn-lg {
  padding: 14px 36px;
  font-size: 16px;
}

.btn-google {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 28px;
  font-size: 15px;
}
.btn-google:hover { background: #f8f9fa; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #d33426; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f8f9fa; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  border-radius: 4px;
}
.btn-icon:hover { background: #f1f3f4; }

/* ============================================
   Dashboard layout
   ============================================ */

.dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

header h1 {
  font-size: 22px;
}

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

.user-email {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Usage badge */
.usage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.usage-green {
  background: #e6f4ea;
  color: var(--success);
}

.usage-yellow {
  background: #fef7e0;
  color: #e37400;
}

.usage-red {
  background: #fce8e6;
  color: var(--danger);
}

/* Trial banner */
.trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.trial-active {
  background: #e8f0fe;
  color: var(--primary-dark);
}

.trial-expired {
  background: #fce8e6;
  color: var(--danger);
}

/* Toggle switch */
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.toggle input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: "";
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--success);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* ============================================
   Categories
   ============================================ */

.categories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.categories-header h2 {
  font-size: 18px;
}

.categories-header-actions {
  display: flex;
  gap: 8px;
}

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

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s;
}

.category-card:hover {
  border-color: var(--primary);
}

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-name {
  font-weight: 600;
  font-size: 16px;
}

.category-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.handler-badges {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: #e8f0fe;
  color: var(--primary);
}

.badge-archive { background: #fce8e6; color: var(--danger); }
.badge-notify { background: #e6f4ea; color: var(--success); }
.badge-log_sheet { background: #fef7e0; color: #e37400; }
.badge-create_task { background: #f3e8fd; color: #8430ce; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

/* ============================================
   Process existing section
   ============================================ */

.process-section {
  margin-top: 32px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.process-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.process-section p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.process-progress {
  margin-bottom: 12px;
}

.process-progress span {
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
  width: 0;
}

.process-status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============================================
   Modal / Editor
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 600px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66,133,244,0.2);
}

/* Handler pipeline editor */
.handler-pipeline {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.handler-pipeline h4 {
  font-size: 14px;
  margin-bottom: 8px;
}

.handler-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 8px;
}

.handler-item-content {
  flex: 1;
}

.handler-type-label {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.handler-config {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.handler-config input,
.handler-config select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

.field-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.field-row input {
  flex: 1;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================
   Loading
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* ============================================
   Toast notifications
   ============================================ */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
  .hero h1 { font-size: 32px; }
  .steps { grid-template-columns: 1fr; gap: 24px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .header-right { gap: 8px; flex-wrap: wrap; }
  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}
