/* OnHyper SPA Styles - Clean & Minimal */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #059669;
  --error: #dc2626;
  --radius: 6px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(
    to bottom,
    var(--bg) 0%,
    var(--bg) 20%,
    #f0f9fc 35%,
    #e8f7fa 50%,
    #f0f9fc 65%,
    var(--bg) 80%,
    var(--bg) 100%
  );
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

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

.nav-links a.nav-cta {
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 12px;
}

.nav-links a.nav-cta:hover {
  color: #fff;
  text-decoration: none;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Hamburger button - hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  position: relative;
  transition: all 0.2s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: var(--text);
  left: 0;
  transition: all 0.2s ease;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

/* Hamburger animation when open */
.nav-open .hamburger {
  background: transparent;
}

.nav-open .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-open .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  /* Show hamburger button */
  .nav-toggle {
    display: block;
  }
  
  /* Reduce nav padding on mobile */
  nav {
    padding: 0.75rem 1rem;
    position: relative;
  }
  
  /* Position nav links as dropdown */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }
  
  /* Open state */
  .nav-open .nav-links {
    max-height: 400px;
    padding: 1rem 0;
  }
  
  /* Style individual links */
  .nav-links a,
  .nav-links button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .nav-links a:hover,
  .nav-links button:hover {
    background: var(--bg-alt);
  }
  
  .nav-links a:last-child,
  .nav-links button:last-child {
    border-bottom: none;
  }
  
  /* Style buttons in mobile menu */
  .nav-links .btn-primary,
  .nav-links .btn-secondary {
    margin: 0.5rem 1rem;
    width: calc(100% - 2rem);
    text-align: center;
    border-radius: var(--radius);
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  nav {
    padding: 0.5rem 0.75rem;
  }
  
  .logo {
    font-size: 1.25rem;
  }
}

/* Main */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

/* Buttons */
button, .btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary, button[type="submit"] {
  background: var(--primary);
  color: white;
}

.btn-primary:hover, button[type="submit"]:hover {
  background: var(--primary-dark);
}

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

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

.btn-danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}

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

/* Forms */
form {
  max-width: 400px;
  margin: 2rem auto;
}

.form-group {
  margin-bottom: 1rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

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

input, textarea, select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

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

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

/*
 * Example HTML structure for app cards:
 *
 * <div class="app-grid">
 *   <div class="app-card">
 *     <div class="app-card-header">
 *       <div class="app-icon">🚀</div>
 *       <div class="app-card-title">
 *         <h3>My App</h3>
 *         <span class="app-url">myapp.onhyper.io</span>
 *       </div>
 *     </div>
 *     <div class="app-card-meta">
 *       <span class="app-meta-item">Created Jan 15, 2026</span>
 *       <span class="app-status app-status--active">Active</span>
 *     </div>
 *     <div class="app-card-actions">
 *       <button class="btn-secondary">Edit</button>
 *       <button class="btn-danger">Delete</button>
 *     </div>
 *   </div>
 *
 *   <div class="app-card app-card--new">
 *     <div class="app-card-new-content">
 *       <span class="app-card-new-icon">+</span>
 *       <span class="app-card-new-text">Create New App</span>
 *     </div>
 *   </div>
 * </div>
 */

/* App Card Grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

/* App Card Base */
.app-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease;
  cursor: default;
}

.app-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Card Header */
.app-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.app-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.5rem;
}

.app-card-title {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.app-card-title h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-url {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Meta Information */
.app-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Card URL Display */
.app-card-url {
  margin-bottom: 0.75rem;
}

.app-url-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.app-url-primary a {
  color: var(--accent-color);
  font-weight: 500;
  text-decoration: none;
}

.app-url-primary a:hover {
  text-decoration: underline;
}

.app-url-copy {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}

.app-url-copy:hover {
  opacity: 1;
  background: var(--bg-alt);
}

.app-url-secondary {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.app-url-secondary a {
  color: var(--text-muted);
  text-decoration: none;
}

.app-url-secondary a:hover {
  text-decoration: underline;
}

.app-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Status Badge */
.app-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.app-status--active {
  background: #dcfce7;
  color: #166534;
}

.app-status--inactive {
  background: #fef3c7;
  color: #92400e;
}

.app-status--error {
  background: #fee2e2;
  color: #991b1b;
}

/* Card Actions */
.app-card-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.app-card-actions button {
  flex: 1;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
  min-height: 40px;
}

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

.app-card-actions .btn-secondary:hover {
  background: var(--border);
  border-color: var(--border);
}

.app-card-actions .btn-danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}

.app-card-actions .btn-danger:hover {
  background: var(--error);
  color: white;
}

/* New App Card (Empty State) */
.app-card--new {
  border: 2px dashed var(--border);
  background: transparent;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.app-card--new:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.02);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.app-card-new-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.app-card-new-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 300;
  color: var(--primary);
  background: var(--bg-alt);
  border-radius: 50%;
  transition: transform 150ms ease;
}

.app-card--new:hover .app-card-new-icon {
  transform: scale(1.1);
}

.app-card-new-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 150ms ease;
}

.app-card--new:hover .app-card-new-text {
  color: var(--primary);
}

/* Key Cards */
.key-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--border);
  border-left: 3px solid var(--provider-color, var(--primary));
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  transition: box-shadow 0.2s;
}

.key-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.key-info {
  flex: 1;
  min-width: 0;
}

.key-name {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.key-value {
  display: block;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Provider badge colors */
.provider-badge {
  --provider-color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  background: color-mix(in srgb, var(--provider-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--provider-color) 30%, var(--border));
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--provider-color);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .key-card {
    flex-wrap: wrap;
  }

  .key-card .btn-small {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* App Actions (legacy support) */
.app-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.app-actions button {
  font-size: 0.85rem;
  padding: 0.5rem 0.875rem;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  max-width: 400px;
  margin: 2rem auto;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.empty-state .btn-large {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.empty-state-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.empty-state-hint a {
  color: var(--primary);
}

.empty-state-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.provider-badge {
  padding: 0.25rem 0.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mobile adjustments for empty states */
@media (max-width: 480px) {
  .empty-state {
    padding: 2rem 1rem;
  }

  .empty-state-icon {
    font-size: 3rem;
  }

  .empty-state h3 {
    font-size: 1.25rem;
  }
}

/* Mobile Responsive */
@media (max-width: 1200px) {
  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
  }

  .app-card {
    padding: 1.25rem;
  }

  .app-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1.25rem;
  }

  .app-card-title h3 {
    font-size: 1rem;
  }

  .app-card-actions button {
    min-height: 44px; /* Touch-friendly */
  }
}

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

  .app-card {
    min-width: 100%;
  }

  .app-card--new {
    min-height: 140px;
  }

  .app-card-actions {
    flex-direction: column;
  }

  .app-card-actions button {
    width: 100%;
  }
}

.key-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.key-name {
  font-weight: 600;
  min-width: 140px;
}

.key-value {
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.hero .cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* Home Page Redesign */
body.page-home {
  background:
    radial-gradient(1100px 620px at 14% -12%, #d9e8ff 0%, transparent 65%),
    radial-gradient(900px 520px at 88% -8%, #dcfef8 0%, transparent 62%),
    #f3f6fb;
  background-attachment: fixed;
}

body.page-home main {
  max-width: 1120px;
  padding: 2.5rem 1.25rem 3.5rem;
}

.home-page {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.home-hero {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 2.25rem;
  align-items: center;
}

.home-pill {
  display: inline-block;
  border: 1px solid #b6d1ff;
  background: #ebf3ff;
  color: #1450b0;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
}

.home-hero h1 {
  margin: 0.85rem 0 0.8rem;
  font-size: clamp(2.1rem, 4.5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #132748;
}

.home-hero-copy > p {
  margin: 0;
  font-size: clamp(1rem, 1.55vw, 1.35rem);
  color: #506784;
  line-height: 1.62;
  max-width: 42rem;
}

.home-actions {
  margin-top: 1.35rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-agent-btn {
  margin-top: 1rem;
  background: transparent;
  border: 2px solid #4f46e5;
  color: #4f46e5;
  border-radius: 10px;
  padding: 0.75rem 1.15rem;
  font-weight: 700;
}

.home-agent-btn:hover {
  border-color: #3730a3;
  color: #3730a3;
  background: #eef2ff;
}

.home-trust {
  margin-top: 0.95rem;
  color: #5c718b;
  font-size: 0.95rem;
}

.home-trust strong {
  color: #1d3350;
  margin-right: 0.4rem;
}

.home-stats {
  margin: 0.75rem 0 0;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 8px;
  display: inline-block;
  font-size: 0.95rem;
  color: #4338ca;
}

.home-stats strong {
  font-weight: 700;
  color: #3730a3;
}

.home-code-card {
  border-radius: 24px;
  background: linear-gradient(168deg, #102946 5%, #173961 100%);
  color: #dcecff;
  border: 1px solid #2d5079;
  box-shadow: 0 18px 40px rgba(14, 35, 63, 0.22);
  padding: 1.4rem;
}

.home-code-card h3 {
  margin: 0 0 0.85rem;
  font-size: 2rem;
  line-height: 1.1;
  color: #f0f7ff;
}

.home-editor {
  border: 1px solid #2a4a74;
  border-radius: 14px;
  background: #0b1f37;
  overflow: hidden;
}

.home-editor-head {
  border-bottom: 1px solid #2a4a74;
  padding: 0.6rem 0.8rem;
}

.home-editor-head span {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 999px;
  background: #4a6a90;
  margin-right: 0.35rem;
}

.home-editor-body {
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #c5daf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.home-editor-body p {
  margin: 0;
}

.home-key {
  color: #8af2db;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-feature {
  background: #fff;
  border: 1px solid #d5e1f0;
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: 0 8px 24px rgba(16, 37, 66, 0.07);
}

.home-feature h3 {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  line-height: 1.15;
  color: #173050;
}

.home-feature p {
  margin: 0;
  color: #5b708a;
}

.home-how {
  background: linear-gradient(180deg, #edf4fe 0%, #f8fbff 100%);
  border: 1px solid #d6e3f1;
  border-radius: 20px;
  padding: clamp(1.2rem, 3.8vw, 2.4rem);
}

.home-how h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.45rem);
  color: #172f4f;
}

.home-how-sub {
  margin: 0.5rem 0 0;
  color: #5c718b;
  font-size: 1.02rem;
}

.home-steps {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-step {
  background: #fff;
  border: 1px solid #d5e1f0;
  border-radius: 14px;
  padding: 1.05rem;
}

.home-step span {
  color: #0d9c94;
  font-weight: 800;
  font-size: 0.76rem;
}

.home-step h3 {
  margin: 0.4rem 0 0.35rem;
  font-size: 1.15rem;
  color: #173050;
}

.home-step p {
  margin: 0;
  color: #5b708a;
}

.home-final-cta {
  background: linear-gradient(160deg, #0f2b48 4%, #173f67 62%, #1e5787 100%);
  border: 1px solid #335d86;
  border-radius: 24px;
  color: #ebf5ff;
  padding: clamp(1.3rem, 4vw, 2.8rem);
}

.home-final-cta h2 {
  margin: 0;
  color: #f3f8ff;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
}

.home-final-cta p {
  margin: 0.75rem 0 0;
  color: #c8dcf5;
  max-width: 48rem;
}

.home-final-cta .btn-secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #f3f8ff;
}

.home-final-cta .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Sections */
h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.feature {
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: var(--radius);
}

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

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

/* Account Bar (User Info) */
.account-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

.account-email {
  color: var(--text);
  font-weight: 500;
}

.account-plan {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-plan.plan-free { background: #e2e8f0; color: #475569; }
.account-plan.plan-hobby { background: #dbeafe; color: #1e40af; }
.account-plan.plan-pro { background: #d1fae5; color: #065f46; }
.account-plan.plan-business { background: #fef3c7; color: #92400e; }
.account-plan.plan-internal { background: #ede9fe; color: #5b21b6; }

.account-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.id-label {
  font-size: 0.8rem;
}

.id-value {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg-alt);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

/* Overview Bar (Sticky Stats Bar) */
.overview-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.overview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.token-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.token-value {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-icon:hover {
  opacity: 1;
}

.btn-small {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

/* Legacy Stats (used on other pages) */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.stat {
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
}

.stat span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat::after {
  content: attr(data-label);
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Error */
.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--success);
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
}

.success code {
  display: block;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: white;
  border-radius: 4px;
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--text);
}

/* Code blocks */
code {
  background: var(--bg-alt);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: var(--text);
}

/* Divider */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Links */
a {
  color: var(--primary);
}

a:hover {
  text-decoration: underline;
}

/* Info box */
.info-box {
  background: var(--bg-alt);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1.5rem;
}

.info-box h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

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

.info-box code {
  margin-top: 0.5rem;
}

/* Subdomain Section */
.subdomain-section {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.subdomain-section > label {
  margin-bottom: 0.5rem;
}

.subdomain-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.subdomain-input-row input {
  flex: 1;
}

.subdomain-input-row button {
  flex-shrink: 0;
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
}

.subdomain-status {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  min-height: 1.25rem;
}

.subdomain-status.success {
  color: var(--success);
}

.subdomain-status.error {
  color: var(--error);
}

.subdomain-preview {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.subdomain-preview strong {
  color: var(--primary);
  font-weight: 500;
}

/* Mobile: stack stats vertically */
@media (max-width: 640px) {
  .overview-bar {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .overview-token {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

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

  nav {
    padding: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  main {
    padding: 1rem;
  }

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

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

  .subdomain-input-row button {
    width: 100%;
  }

  .home-hero,
  .home-feature-grid,
  .home-steps {
    grid-template-columns: 1fr;
  }

  .home-code-card {
    padding: 1rem;
  }

  .home-code-card h3,
  .home-feature h3 {
    font-size: 1.6rem;
  }

  .home-final-cta {
    border-radius: 18px;
  }
}

@media (max-width: 480px) {
  body.page-home main {
    padding: 1.5rem 0.85rem 2.5rem;
  }

  .home-pill {
    font-size: 0.78rem;
  }

  .home-agent-btn {
    width: 100%;
  }
}

/* Blog Styles */
.blog-main {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.blog-main h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.blog-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.blog-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}

.rss-link:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

.rss-link svg {
  opacity: 0.8;
}

.blog-grid {
  display: grid;
  gap: 1.5rem;
}

.blog-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
}

.blog-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.blog-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.blog-card .excerpt {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0.75rem 0;
}

/* Post Page */
.post-main {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--primary);
}

#post-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* Post Meta */
.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.post-meta .author::before {
  content: '·';
  margin-right: 1rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  display: inline-block;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Post Content Typography */
.post-body {
  margin-top: 2rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--text);
}

.post-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.post-body p {
  margin: 1rem 0;
}

.post-body ul,
.post-body ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post-body li {
  margin: 0.5rem 0;
}

.post-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.post-body code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.post-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.post-body :not(pre) > code {
  background: var(--bg-alt);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875rem;
  color: var(--text);
}

.post-body blockquote {
  border-left: 4px solid var(--primary);
  margin: 1rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  color: var(--text-muted);
  font-style: italic;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-body a {
  color: var(--primary);
  text-decoration: underline;
}

.post-body a:hover {
  text-decoration: none;
}

.post-body strong {
  font-weight: 600;
}

.post-body em {
  font-style: italic;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1rem 0;
}

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

/* Chat Page */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.chat-header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.chat-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
}

.message.user {
  background: var(--primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  background: var(--bg-alt);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  margin-right: auto;
}

.message-content {
  line-height: 1.6;
}

/* Markdown styling */
.message-content p {
  margin: 0 0 0.75em 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

.message-content ul, .message-content ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.message-content li {
  margin: 0.25em 0;
}

.message-content code {
  background: rgba(0,0,0,0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.85em;
}

.message-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 10px 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.message-content pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.message-content h1, .message-content h2, .message-content h3 {
  margin: 1em 0 0.5em 0;
  font-weight: 600;
  line-height: 1.3;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }

.message-content a {
  color: var(--primary);
  text-decoration: underline;
}

.message-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1em;
  margin: 0.5em 0;
  color: var(--text-muted);
}

.message.user .message-content pre {
  background: rgba(255,255,255,0.15);
  color: white;
}

.message.user .message-content code {
  background: rgba(255,255,255,0.2);
}

.chat-input {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 16px;
  transition: border-color 0.15s;
}

.chat-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-input button {
  padding: 14px 24px;
  min-height: 44px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.15s;
}

.chat-input button:hover {
  background: var(--primary-dark);
}

.chat-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
}

/* Lead capture */
.lead-capture {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 16px;
  margin-top: auto;
}

.lead-content {
  text-align: center;
}

.lead-content p {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 12px;
}

.lead-form {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.lead-form input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
}

.lead-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.lead-form button {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.lead-form button:hover {
  background: var(--primary-dark);
}

.lead-success {
  color: var(--success);
  font-weight: 500;
  padding: 12px;
}

/* Chat responsive */
@media (max-width: 768px) {
  .chat-container {
    padding: 12px;
    height: calc(100vh - 60px);
  }
  
  .chat-header {
    padding: 16px 0;
  }
  
  .chat-header h1 {
    font-size: 1.25rem;
  }
  
  .message {
    max-width: 85%;
    padding: 10px 14px;
  }
  
  .chat-input {
    gap: 8px;
    padding: 12px 0;
  }
  
  .chat-input input {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .chat-input button {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 14px;
  }
  
  .lead-form {
    flex-direction: column;
    max-width: 300px;
  }
  
  .lead-form button {
    margin-top: 8px;
  }
}

/* Footer */
.site-footer {
  margin-top: 60px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
}

.site-footer .divider {
  margin: 0 8px;
}

.site-footer .copyright {
  margin-top: 8px;
  font-size: 12px;
}
/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms, visibility 150ms;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  transition: transform 150ms;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

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

.modal-header h2 {
  margin-bottom: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.6;
  color: var(--text);
  line-height: 1;
}

.modal-close:hover {
  opacity: 1;
}

.modal-content {
  color: var(--text);
}

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

/* Keyboard shortcuts help */
.shortcuts-help h3 {
  margin-bottom: 1rem;
  margin-top: 0;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.shortcut kbd {
  display: inline-block;
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}

.shortcut span {
  color: var(--text-muted);
}

/* Shortcuts hint in tabs */
.shortcuts-hint {
  margin-left: auto;
  opacity: 0.5;
  font-size: 0.85rem;
  cursor: help;
  padding: 0.75rem 0;
}

.shortcuts-hint:hover {
  opacity: 1;
}

/* Toast notifications */
.toast {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

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

/* Mobile Bottom Navigation */
@media (max-width: 640px) {
  .dashboard-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }

  .dashboard-tabs .tab {
    flex: 1;
    flex-direction: column;
    padding: 0.5rem;
    font-size: 0.7rem;
    border-radius: 0;
    background: transparent;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: none;
    margin-bottom: 0;
  }

  .dashboard-tabs .tab::before {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    display: block;
  }

  .dashboard-tabs .tab[data-tab="apps"]::before {
    content: "📱";
  }

  .dashboard-tabs .tab[data-tab="keys"]::before {
    content: "🔑";
  }

  .dashboard-tabs .tab[data-tab="settings"]::before {
    content: "⚙️";
  }

  .dashboard-tabs .tab.active {
    color: var(--primary);
    background: transparent;
    border-bottom: none;
  }

  .tab-content {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }

  .overview-bar {
    position: relative;
    top: auto;
  }
}

/* Secondary Page Redesign */
.subpage-hero {
  text-align: left;
  padding: 0.25rem 0 0.75rem;
  max-width: 900px;
}

.subpage-hero h1 {
  margin: 0.8rem 0 0.55rem;
  font-size: clamp(1.8rem, 3.7vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: #132748;
}

.subpage-hero p {
  margin: 0;
  color: #5b708a;
  font-size: clamp(0.98rem, 1.4vw, 1.16rem);
}

.redesign-surface {
  border: 1px solid #d5e1f0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(16, 37, 66, 0.08);
}

body.page-blog .blog-main {
  margin-top: 0.75rem;
  padding: 1.25rem;
}

body.page-blog .blog-grid {
  gap: 1rem;
}

body.page-blog .blog-card {
  border-radius: 14px;
  border: 1px solid #d5e1f0;
  background: #f9fcff;
}

body.page-blog .blog-card:hover {
  border-color: #3a63d9;
  box-shadow: 0 8px 24px rgba(19, 39, 72, 0.12);
}

body.page-blog .blog-card h2 {
  font-size: 1.45rem;
  margin-bottom: 0.3rem;
}

body.page-blog .rss-link {
  border-color: #cedcf0;
  border-radius: 12px;
  background: #f4f9ff;
}

body.page-chat .chat-container {
  background: #ffffff;
  border: 1px solid #d5e1f0;
  border-radius: 18px;
  padding: 1rem;
  height: calc(100vh - 300px);
  min-height: 560px;
}

body.page-chat .chat-header {
  border-bottom-color: #d9e5f4;
}

body.page-chat .chat-header h1 {
  color: #173050;
}

body.page-chat .chat-input {
  border-top-color: #d9e5f4;
}

body.page-chat .chat-input input {
  border: 1px solid #c9d9ee;
  background: #f6fbff;
}

body.page-chat .chat-input button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

body.page-login .auth-shell,
body.page-signup .auth-shell {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 1.6rem;
  align-items: start;
}

body.page-login .auth-copy,
body.page-signup .auth-copy {
  padding-top: 0.75rem;
}

body.page-login .auth-copy h1,
body.page-signup .auth-copy h1 {
  margin: 0.8rem 0 0.65rem;
  font-size: clamp(1.9rem, 3.9vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #132748;
}

body.page-login .auth-copy p,
body.page-signup .auth-copy p {
  margin: 0;
  color: #5b708a;
  font-size: 1.06rem;
  line-height: 1.65;
}

body.page-login .auth-card,
body.page-signup .auth-card {
  border: 1px solid #d5e1f0;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(16, 37, 66, 0.1);
  padding: 1.2rem;
}

body.page-login .auth-card h2,
body.page-signup .auth-card h2 {
  margin: 0 0 0.75rem;
  color: #173050;
}

body.page-login .auth-card form,
body.page-signup .auth-card form {
  max-width: none;
  margin: 0;
}

body.page-login .auth-card input,
body.page-signup .auth-card input {
  background: #f8fbff;
  border-color: #cbd9ec;
}

body.page-login .auth-submit,
body.page-signup .auth-submit {
  width: 100%;
  margin-top: 0.4rem;
}

body.page-login .auth-links,
body.page-signup .auth-links {
  text-align: center;
  margin-top: 0.85rem;
  color: #627995;
}

body.page-skill .skill-page {
  margin-top: 0.75rem;
  padding: 1.25rem;
  max-width: 100%;
}

body.page-skill .skill-header {
  text-align: left;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid #d5e1f0;
  margin-bottom: 1.4rem;
}

body.page-skill .skill-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.1vw, 2.4rem);
  color: #173050;
}

body.page-skill .skill-subtitle {
  margin-top: 0.5rem;
  color: #5b708a;
  max-width: 60ch;
}

body.page-skill .skill-section {
  margin-bottom: 1.6rem;
}

body.page-skill .skill-section h2 {
  font-size: 1.45rem;
  margin-bottom: 0.7rem;
  color: #173050;
  border-bottom: 1px solid #d5e1f0;
  padding-bottom: 0.4rem;
}

body.page-skill .skill-section h3 {
  margin: 1rem 0 0.5rem;
  color: #173050;
}

body.page-skill .skill-section h4 {
  margin: 0.8rem 0 0.4rem;
  color: #1f3c60;
}

body.page-skill .skill-section p,
body.page-skill .skill-section li {
  color: #506784;
  line-height: 1.65;
}

body.page-skill .skill-section .note {
  background: #eef4ff;
  border: 1px solid #cfdcf2;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-style: normal;
}

body.page-skill .feature-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

body.page-skill .feature-highlight {
  background: #f9fcff;
  border: 1px solid #d5e1f0;
  border-radius: 12px;
  padding: 0.85rem;
}

body.page-skill .feature-highlight p {
  margin: 0;
  font-size: 0.9rem;
}

body.page-skill .api-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.9rem;
}

body.page-skill .api-table th,
body.page-skill .api-table td {
  border-bottom: 1px solid #d9e5f4;
  text-align: left;
  padding: 0.65rem 0.75rem;
}

body.page-skill .api-table th {
  background: #eef4ff;
  color: #173050;
}

body.page-skill .api-table tr:hover {
  background: #f7fbff;
}

body.page-skill .skill-section pre {
  background: #0e2743;
  color: #d8e9ff;
  border: 1px solid #325880;
  border-radius: 12px;
  padding: 0.9rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

body.page-skill .skill-section pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

body.page-dashboard .dashboard-shell {
  border: 1px solid #d5e1f0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(16, 37, 66, 0.08);
  overflow: hidden;
}

body.page-dashboard .overview-bar {
  position: static;
  top: auto;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 120px)) 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #d9e5f4;
  background: linear-gradient(180deg, #f6fbff 0%, #eef5ff 100%);
}

body.page-dashboard .overview-stat {
  align-items: flex-start;
}

body.page-dashboard .overview-stat .stat-value {
  color: #173050;
  font-size: 1.9rem;
}

body.page-dashboard .overview-stat .stat-label {
  color: #617894;
}

body.page-dashboard .overview-token {
  margin-left: auto;
  justify-content: flex-end;
  gap: 0.6rem;
}

body.page-dashboard .token-value {
  max-width: 290px;
  background: #fff;
  border: 1px solid #cbd9ec;
  border-radius: 8px;
  color: #173050;
  padding: 0.35rem 0.6rem;
}

body.page-dashboard .tabs-container {
  padding: 0 1.25rem;
}

body.page-dashboard .dashboard-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #d9e5f4;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.page-dashboard .dashboard-tabs .tab {
  padding: 0.78rem 1.05rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 700;
  color: #58708a;
  white-space: nowrap;
}

body.page-dashboard .dashboard-tabs .tab:hover {
  color: #173050;
}

body.page-dashboard .dashboard-tabs .tab.active {
  color: #1f57ca;
  border-bottom-color: #1f57ca;
}

body.page-dashboard .dashboard-tabs .tab:focus {
  outline: none;
  border-radius: 0;
}

body.page-dashboard .dashboard-tabs .tab:focus-visible {
  outline: none;
  color: #1f57ca;
  border-bottom-color: #1f57ca;
}

body.page-dashboard .tab-content {
  padding: 1.15rem 1.25rem 1.5rem;
  min-height: 240px;
}

body.page-dashboard .tab-panel {
  display: none;
}

body.page-dashboard .tab-panel.active {
  display: block;
}

body.page-dashboard .text-muted {
  color: #5b708a;
}

body.page-dashboard .settings-section {
  background: #f8fbff;
  border: 1px solid #d9e5f4;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

body.page-dashboard .settings-section h3 {
  margin: 0 0 0.8rem;
  color: #173050;
}

body.page-dashboard .setting-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid #d9e5f4;
}

body.page-dashboard .setting-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

body.page-dashboard .setting-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}

body.page-dashboard .setting-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

body.page-dashboard .setting-title {
  font-weight: 700;
  color: #173050;
}

body.page-dashboard .setting-description {
  margin: 0.45rem 0 0 1.6rem;
  color: #5b708a;
  font-size: 0.92rem;
}

body.page-dashboard .app-card-stats {
  display: flex;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-top: 1px solid #d9e5f4;
  border-bottom: 1px solid #d9e5f4;
  margin: 0.6rem 0;
}

body.page-dashboard .app-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
}

body.page-dashboard .app-stat .stat-icon {
  font-size: 0.95rem;
}

body.page-dashboard .app-stat .stat-value {
  font-weight: 700;
  color: #173050;
}

body.page-dashboard .app-stat .stat-label {
  color: #5b708a;
  font-size: 0.74rem;
}

body.page-dashboard .app-stat--error .stat-value {
  color: #dc2626;
}

body.page-dashboard .activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

body.page-dashboard .activity-filters {
  display: flex;
  gap: 0.45rem;
}

body.page-dashboard .activity-filters select {
  padding: 0.48rem 0.6rem;
  border: 1px solid #cbd9ec;
  border-radius: 8px;
  background: #fff;
  color: #173050;
  font-size: 0.88rem;
}

body.page-dashboard .activity-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.8rem;
}

body.page-dashboard .activity-table tr {
  border-bottom: 1px solid #d9e5f4;
}

body.page-dashboard .activity-table td {
  padding: 0.7rem 0;
}

body.page-dashboard .activity-action {
  font-weight: 600;
}

body.page-dashboard .activity-time {
  text-align: right;
  color: #5b708a;
  font-size: 0.86rem;
}

body.page-dashboard .timeline {
  position: relative;
  padding-left: 1.8rem;
}

body.page-dashboard .timeline::before {
  content: '';
  position: absolute;
  left: 0.7rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d9e5f4;
}

body.page-dashboard .timeline-item {
  position: relative;
  padding-bottom: 1.2rem;
}

body.page-dashboard .timeline-item:last-child {
  padding-bottom: 0;
}

body.page-dashboard .timeline-icon {
  position: absolute;
  left: -1.85rem;
  width: 1.5rem;
  height: 1.5rem;
  background: #fff;
  border: 2px solid #1f57ca;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  z-index: 1;
}

body.page-dashboard .timeline-content {
  padding-left: 0.4rem;
}

body.page-dashboard .timeline-action {
  font-weight: 600;
}

body.page-dashboard .timeline-time {
  font-size: 0.85rem;
  color: #5b708a;
  margin-top: 0.2rem;
}

body.page-dashboard .timeline-details {
  font-size: 0.75rem;
  color: #5b708a;
  margin-top: 0.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #f2f7ff;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  display: inline-block;
}

@media (max-width: 900px) {
  body.page-dashboard .overview-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.page-dashboard .overview-token {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  body.page-dashboard .tabs-container {
    padding: 0 0.85rem;
  }

  body.page-dashboard .tab-content {
    padding: 0.9rem 0.85rem 4.8rem;
  }

  body.page-dashboard .dashboard-tabs .tab[data-tab="activity"] {
    display: none;
  }

  body.page-dashboard #tab-activity {
    display: none !important;
  }

  body.page-dashboard .activity-header {
    flex-direction: column;
    align-items: flex-start;
  }

  body.page-dashboard .activity-filters {
    width: 100%;
  }

  body.page-dashboard .activity-filters select {
    flex: 1;
  }
}

@media (max-width: 900px) {
  body.page-login .auth-shell,
  body.page-signup .auth-shell {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  body.page-chat .chat-container {
    height: calc(100vh - 260px);
    min-height: 500px;
  }
}

@media (max-width: 768px) {
  .subpage-hero {
    padding-top: 0.1rem;
  }

  body.page-blog .blog-main,
  body.page-skill .skill-page,
  body.page-chat .chat-container,
  body.page-login .auth-card,
  body.page-signup .auth-card {
    padding: 0.9rem;
    border-radius: 14px;
  }

  body.page-skill .api-table {
    font-size: 0.8rem;
  }

  body.page-skill .api-table th,
  body.page-skill .api-table td {
    padding: 0.5rem 0.55rem;
  }
}

/* Analytics Dashboard */
.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-header h2 {
  margin: 0;
}

.analytics-controls {
  display: flex;
  gap: 0.75rem;
}

.analytics-controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

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

.analytics-empty {
  text-align: center;
  padding: 3rem 1rem;
}

.analytics-empty .empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.analytics-empty h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
}

.analytics-empty p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Analytics Cards */
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.analytics-card .card-icon {
  font-size: 2rem;
}

.analytics-card .card-data {
  flex: 1;
}

.analytics-card .card-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.analytics-card .card-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Analytics Sections */
.analytics-section {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.analytics-section h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Analytics Chart */
.analytics-chart {
  min-height: 200px;
}

.chart-bars {
  display: flex;
  gap: 4px;
  height: 160px;
  align-items: flex-end;
  padding-bottom: 30px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

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

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* Two Column Layout */
.analytics-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Top Events */
.top-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.event-bar-container {
  width: 60px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

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

.event-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.event-name {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Apps List */
.analytics-apps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.analytics-app-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.analytics-app-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.analytics-app-item .app-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.analytics-app-item .app-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.analytics-app-item .app-stats .stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.analytics-app-item .app-stats .stat-error {
  color: var(--error);
}

/* Errors Section */
.analytics-errors {
  background: var(--bg-alt);
  border: 1px solid var(--error);
  border-radius: 12px;
  padding: 1.25rem;
}

.analytics-errors h3 {
  color: var(--error);
  margin: 0 0 0.5rem;
}

.analytics-errors p {
  margin: 0;
  color: var(--text);
}

.analytics-errors a {
  color: var(--primary);
  font-weight: 500;
}

/* Analytics Responsive */
@media (max-width: 900px) {
  .analytics-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .analytics-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .analytics-controls {
    width: 100%;
  }

  .analytics-controls select {
    flex: 1;
  }

  .analytics-cards {
    grid-template-columns: 1fr;
  }

  .analytics-card {
    padding: 1rem;
  }

  .analytics-card .card-value {
    font-size: 1.5rem;
  }
}
