:root {
  --bg: #000000;
  --surface: #0e0e0e;
  --surface-2: #161616;
  --surface-3: #1f1f1f;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #ffffff;
  --text-2: #8e8e93;
  --text-3: #6b6b70;
  --accent: #d4a574;
  --accent-soft: rgba(212,165,116,0.12);
  --gold: #ffd700;
  --imsg-blue: #0a84ff;
  --imsg-gray: #262628;
  --green: #30d158;
  --green-soft: rgba(48,209,88,0.12);
  --red: #ff453a;
  --purple: #bf5af2;
  --blue: #5a7ab9;
}
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #1a1a1a;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}
.phone-frame {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}
@media (min-width: 500px) {
  .phone-frame {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    height: 900px;
    border-radius: 48px;
    border: 8px solid #1c1c1e;
    overflow: hidden;
  }
}
.scroll-area {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 110px;
}
.scroll-area::-webkit-scrollbar { display: none; }
.status-bar {
  height: 48px;
  padding: 14px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #000 80%, transparent);
}
.tab-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(20,20,22,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  padding: 8px 8px 22px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  z-index: 40;
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.15s;
  cursor: pointer;
}
.tab-btn.active { color: var(--accent); }
.tab-btn:active { opacity: 0.5; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.card-2 {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.card-3 {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.tap { transition: transform 0.12s ease, opacity 0.12s ease; cursor: pointer; }
.tap:active { transform: scale(0.97); opacity: 0.85; }
.view { animation: fadeIn 0.22s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal {
  position: absolute; inset: 0;
  background: var(--bg);
  z-index: 60;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes slideOutDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
.modal.closing { animation: slideOutDown 0.24s cubic-bezier(0.32, 0.72, 0, 1) forwards; }
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: rgba(40,40,42,0.95);
  backdrop-filter: blur(20px);
  color: white;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.8s forwards;
  max-width: 80%;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}
.bubble-them {
  background: var(--imsg-gray);
  color: white;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  max-width: 78%;
  font-size: 16px;
  line-height: 1.35;
  align-self: flex-start;
  word-wrap: break-word;
}
.bubble-me {
  background: var(--imsg-blue);
  color: white;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 14px;
  max-width: 78%;
  font-size: 16px;
  line-height: 1.35;
  align-self: flex-end;
  word-wrap: break-word;
}
.bubble-draft {
  background: rgba(212,165,116,0.08);
  border: 1.5px dashed rgba(212,165,116,0.55);
  color: white;
  border-radius: 18px;
  padding: 12px 14px;
  max-width: 82%;
  font-size: 16px;
  line-height: 1.35;
  align-self: flex-end;
  position: relative;
}
.bubble-draft::before {
  content: "AI DRAFT";
  position: absolute;
  top: -8px; right: 14px;
  background: var(--accent);
  color: black;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
}
.vip-badge {
  background: linear-gradient(135deg, #ffd700, #c8a04a);
  color: #1a1300;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 4px;
}
.progress-step {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.progress-step.done { background: var(--green); color: #00220a; }
.progress-step.current { background: var(--accent); color: #1a1100; box-shadow: 0 0 0 4px rgba(212,165,116,0.18); }
.progress-step.pending { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.progress-line {
  flex: 1; height: 2px; background: var(--surface-2); position: relative; margin: 0 4px;
}
.progress-line.done { background: var(--green); }
.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.filter-chip.active {
  background: var(--accent);
  color: #1a1100;
  border-color: var(--accent);
}
.icon-tile {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
  letter-spacing: 0.5px;
}
.stat-num {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  font-feature-settings: "tnum";
}
.nums { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
input, textarea, button, select { font-family: inherit; }
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: white;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #1a1100;
  font-weight: 700;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  letter-spacing: 0.2px;
  border: none;
  cursor: pointer;
}
.btn-secondary {
  background: var(--surface-2);
  color: white;
  font-weight: 600;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.btn-ghost {
  color: var(--text-2);
  font-weight: 600;
  padding: 13px 16px;
  font-size: 15px;
  background: none;
  border: none;
  cursor: pointer;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(48,209,88,0.7);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(48,209,88,0.7); }
  70% { box-shadow: 0 0 0 8px rgba(48,209,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); }
}
.hide-scroll::-webkit-scrollbar { display: none; }
.glow-card {
  background: linear-gradient(135deg, rgba(212,165,116,0.14) 0%, rgba(212,165,116,0.04) 100%);
  border: 1px solid rgba(212,165,116,0.35);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.glow-card::before {
  content: "";
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: radial-gradient(circle at 0% 0%, rgba(212,165,116,0.18), transparent 60%);
  pointer-events: none;
}
.lucide { width: 1em; height: 1em; }
.conn-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}
.conn-strip::-webkit-scrollbar { display: none; }
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.conn-pill i { width: 12px; height: 12px; color: var(--green); }
.conn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

/* Activity feed */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-dot {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}
.activity-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.4px;
  flex-shrink: 0;
  width: 48px;
  padding-top: 6px;
}
.activity-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.activity-body .meta { color: var(--text-2); font-size: 12px; margin-top: 2px; }

/* Connections list */
.conn-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.conn-row:last-child { border-bottom: none; }
.conn-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.conn-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 4px;
}
.conn-status.live { background: var(--green-soft); color: var(--green); }
.conn-status.warn { background: rgba(255,159,10,0.15); color: #ffb340; }

/* Autonomy slider */
.auton-track {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  margin: 16px 0 10px;
}
.auton-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 999px;
  transform-origin: left;
}
.auton-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.auton-labels span { text-align: center; }
.auton-labels span.active { color: var(--accent); }

/* Settings rows */
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.toggle {
  width: 44px; height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle.on::after { transform: translateX(18px); }

/* Mini sparkline for activity volume */
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.spark-bars span {
  width: 4px;
  background: var(--accent);
  border-radius: 1px;
  opacity: 0.65;
}
