:root {
  --bg: #050816;
  --bg-elevated: #0b1020;
  --bg-card: #101425;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --primary: #4f46e5;
  --primary-soft: rgba(79, 70, 229, 0.16);
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 20px 40px rgba(15, 23, 42, 0.7);
  --shadow-subtle: 0 12px 30px rgba(15, 23, 42, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, #0b1120 0, #020617 38%, #000 100%);
  color: var(--text-main);
}

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.4rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.75), transparent);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 0.1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #22c55e, #4f46e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45);
}

.brand-text {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.98rem;
}

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

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.18s ease-out;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
}

.nav-link-primary {
  background: linear-gradient(to right, #4f46e5, #22c55e);
  color: #f9fafb;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.55);
}

.nav-link-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.page-main {
  flex: 1;
  padding: 2.2rem 0 3.2rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr);
  gap: 2.4rem;
  align-items: center;
  margin-bottom: 3rem;
}

.hero-copy-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.9rem;
}

.hero-copy-eyebrow-pill {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #22c55e, #4f46e5);
}

.hero-title {
  font-size: clamp(2.3rem, 3vw, 3rem);
  line-height: 1.08;
  margin: 0 0 0.9rem;
}

.hero-title span {
  background: linear-gradient(to right, #e5e7eb, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 32rem;
  font-size: 0.98rem;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease-out;
}

.button-primary {
  background: linear-gradient(to right, #4f46e5, #22c55e);
  color: #f9fafb;
  box-shadow: 0 18px 38px rgba(79, 70, 229, 0.58);
}

.button-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.button-ghost {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
}

.button-ghost:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.95);
}

.hero-metrics {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hero-metric strong {
  color: var(--text-main);
}

.hero-panel {
  position: relative;
  border-radius: 24px;
  padding: 1.4rem 1.3rem 1.5rem;
  background: radial-gradient(circle at 20% 0, rgba(56, 189, 248, 0.25), transparent 55%),
    radial-gradient(circle at 90% 0, rgba(94, 234, 212, 0.16), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.95));
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

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

.hero-panel-title {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-panel-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
}

.app-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 1.1rem;
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.24), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.94));
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out, border-color 0.18s ease-out;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.9);
  border-color: rgba(129, 140, 248, 0.9);
}

.app-card-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.app-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #22c55e, #4f46e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

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

.app-card-category {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.app-card-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.app-price {
  display: flex;
  flex-direction: column;
}

.app-price-main {
  font-weight: 600;
}

.app-price-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.app-detail {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 2.2rem;
}

.app-detail-main-title {
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
}

.app-detail-short {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.app-detail-body {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.98rem;
}

.app-detail-sidebar {
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-subtle);
}

.app-detail-price-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.app-detail-price-main {
  font-size: 1.5rem;
  font-weight: 600;
}

.app-detail-price-main span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-detail-meta {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.embed-snippet {
  margin-top: 1.4rem;
}

.embed-snippet pre {
  margin: 0.4rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  background: #020617;
  border: 1px solid rgba(15, 23, 42, 0.9);
  overflow-x: auto;
  font-size: 0.78rem;
}

.platforms-strip {
  margin-top: 2rem;
}

.platforms-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem 0 0.4rem;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.platform-pill i {
  font-size: 0.9rem;
}

.section-heading {
  font-size: 1.1rem;
  margin: 0 0 0.8rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.3rem;
}

.section-spacer {
  margin-top: 2.3rem;
}

.empty-state {
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Generic card + admin layout */
.card {
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-subtle);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 2rem;
}

.admin-grid-secondary {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

@media (max-width: 900px) {

  .admin-grid,
  .admin-grid-secondary {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Shared form elements used in admin UI */
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.9);
  background: #020617;
  color: var(--text-main);
  font-size: 0.9rem;
}

.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.8);
}

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

.list {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.list li {
  margin-bottom: 0.25rem;
}

/* Chatbot admin: Recent crawls layout */
#cb-crawls .list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

#cb-crawls .list li .list-main {
  flex: 1 1 auto;
  min-width: 0;
}

#cb-crawls .list li .list-actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

@media (max-width: 640px) {
  #cb-crawls .list li {
    align-items: flex-start;
    flex-direction: column;
  }

  #cb-crawls .list li .list-actions {
    flex-wrap: wrap;
  }
}

/* Chatbot admin: indexed content toolbar */
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.list-toolbar-main {
  flex: 1 1 auto;
  min-width: 0;
}

.list-toolbar-filters {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 0.4rem;
}

#cb-doc-pagination .button {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

.auth-shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 2.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.6rem 1.8rem;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-soft);
  margin: 0 auto;
}

.auth-card-title {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
}

.auth-card-subtitle {
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.9);
  background: #020617;
  color: var(--text-main);
  font-size: 0.9rem;
}

.auth-input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.8);
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.auth-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

.auth-link:hover {
  color: var(--text-main);
}

.auth-alert {
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
}

.auth-alert-error {
  background: rgba(248, 113, 113, 0.11);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.site-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.26);
  padding: 1.2rem 0 1.4rem;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
}

.footer-inner {
  text-align: center;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-panel {
    order: -1;
  }

  .app-detail {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .nav-links {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .hero-cta {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Usage Statistics Dashboard */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.usage-stat {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.usage-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

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

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

.usage-table thead {
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.usage-table th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
}

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

.usage-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.6);
}

/* Super Admin Client Indicator */
.super-client-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.2);
  border: 1px solid rgba(129, 140, 248, 0.6);
  color: #a5b4fc;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-right: 1rem;
}

/* Modal Overlay */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-main);
}