/* DeskPilot — design tokens and app styles */
:root {
  --bg: #0a0a0f;
  --bg-raised: #13131a;
  --bg-card: #1a1a24;
  --fg: #e8e6e3;
  --fg-muted: #8a8a96;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --radius: 12px;
  --max-w: 1100px;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }

/* ===== NAV ===== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-brand-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

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

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--fg);
  background: var(--bg-card);
}

.nav-link.active { color: var(--accent); }

/* ===== LAYOUT ===== */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

/* ===== STAT GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-card-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 100px;
  text-transform: uppercase;
}

.badge-green { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-yellow { background: var(--accent-soft); color: var(--accent); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-gray { background: rgba(255,255,255,0.08); color: var(--fg-muted); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { background: #fbbf24; }

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.12);
}

.btn-outline:hover { border-color: rgba(255,255,255,0.25); background: var(--bg-card); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

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

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

/* ===== CALL SIMULATOR ===== */
.simulator-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .simulator-wrap { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

.chat-window {
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  min-height: 400px;
  max-height: 500px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(245,158,11,0.2);
  color: var(--fg);
}

.chat-msg.ai {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
}

.chat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.78rem;
  border: none;
  padding: 2px 0;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

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

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state p { margin-bottom: 16px; }

/* ===== INTENT CHIP ===== */
.intent-chip {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-family: 'Space Grotesk', monospace;
}

/* ===== SECTION GRID ===== */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.875rem;
  z-index: 300;
  animation: slideUp 0.2s ease;
  max-width: 320px;
}

.toast.success { border-color: rgba(34,197,94,0.3); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.3); color: var(--red); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== KNOWLEDGE GRID ===== */
.kb-grid {
  display: grid;
  gap: 12px;
}

.kb-item {
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.kb-content { flex: 1; }

.kb-question {
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.kb-answer {
  color: var(--fg-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.kb-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.kb-actions button {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.kb-actions button:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.kb-actions .del-btn:hover { color: var(--red); }

/* ===== LOADING SPINNER ===== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== HERO SECTION (landing page compat) ===== */
.hero {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

.hero-badge {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(245,158,11,0.2);
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 700;
  margin-bottom: 24px;
  max-width: 800px;
}

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

.lede {
  font-size: 1.2rem;
  color: var(--fg-muted);
  max-width: 580px;
  margin-bottom: 56px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1rem;
  border-radius: 10px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 28px 40px;
  background: var(--bg-raised);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  flex-wrap: wrap;
  justify-content: center;
}

.stat { text-align: center; }

.stat-number {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--fg-muted);
  max-width: 120px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.08);
}

/* Sections */
section {
  padding: 80px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 16px;
}

.section-sub {
  color: var(--fg-muted);
  font-size: 1rem;
  max-width: 520px;
  line-height: 1.7;
}

footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 40px 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
