:root {
  --bg: #0f0f14;
  --surface: #1a1a26;
  --surface2: #22223a;
  --border: #2e2e4a;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --green: #43e97b;
  --yellow: #f9ca24;
  --red: #ff4757;
  --text: #e8e8f0;
  --muted: #7b7b99;
  --radius: 14px;
  --font: 'DM Sans', sans-serif;
  --mono: 'Space Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 20, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
}

.navbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  flex: 1;
  font-family: var(--mono);
}

.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}

.btn-icon:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
}

.tab-btn {
  flex: 1;
  padding: 10px 4px 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color .2s;
}

.tab-btn .tab-icon { font-size: 20px; }
.tab-btn.active { color: var(--accent); }

.page { display: none; padding: 16px; }
.page.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  transition: border-color .2s;
}

.card:active { border-color: var(--accent); }
.card-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: 13px; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .85; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #000; }
.btn-whatsapp { background: #25D366; color: #fff; display: flex; align-items: center; gap: 6px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-full { width: 100%; text-align: center; }

.fab {
  position: fixed;
  bottom: 72px;
  right: 16px;
  z-index: 99;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(108, 99, 255, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
}

.fab:active { transform: scale(.93); }

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

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

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 16px;
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

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

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color .2s;
}

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

select option { background: var(--surface); }
textarea { resize: vertical; min-height: 80px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
}

.badge-new       { background: rgba(108,99,255,.2); color: var(--accent); }
.badge-progress  { background: rgba(249,202,36,.2); color: var(--yellow); }
.badge-resolved  { background: rgba(67,233,123,.2); color: var(--green); }
.badge-closed    { background: rgba(123,123,153,.15); color: var(--muted); }
.badge-cancelled { background: rgba(255,71,87,.15); color: var(--red); }
.badge-pending   { background: rgba(255,101,132,.2); color: var(--accent2); }

.type-lead      { background: rgba(108,99,255,.15); color: var(--accent); }
.type-request   { background: rgba(67,233,123,.15); color: var(--green); }
.type-complaint { background: rgba(255,71,87,.15); color: var(--red); }
.type-task      { background: rgba(249,202,36,.15); color: var(--yellow); }
.type-followup  { background: rgba(255,101,132,.15); color: var(--accent2); }
.type-other     { background: rgba(123,123,153,.15); color: var(--muted); }

.search-bar { position: relative; margin-bottom: 14px; }
.search-bar input { padding-left: 38px; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.stat-num { font-size: 28px; font-weight: 700; font-family: var(--mono); color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title { font-size: 16px; font-weight: 700; }

.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.detail-label { font-size: 12px; color: var(--muted); width: 90px; flex-shrink: 0; padding-top: 2px; }
.detail-value { font-size: 14px; flex: 1; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show { opacity: 1; }
.loading { text-align: center; padding: 30px; color: var(--muted); }

.segment { display: flex; background: var(--surface2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.seg-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

@media (min-width: 480px) {
  body { max-width: 480px; margin: 0 auto; }
  .modal { border-radius: var(--radius); margin-bottom: 20px; }
  .modal-overlay { align-items: center; }
}
