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

:root {
  --bg:      #0c0c0e;
  --bg2:     #141416;
  --bg3:     #1c1c1f;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text:    #f0ede8;
  --text2:   #8c8984;
  --text3:   #4a4845;
  --accent:  #d4a853;
  --accent2: #b8923e;
  --danger:  #e05555;
  --success: #4caf7d;
  --r:       12px;
  --rs:      8px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-weight: 300; -webkit-font-smoothing: antialiased; }

#app { max-width: 430px; margin: 0 auto; min-height: 100vh; }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ── TOP BAR ── */
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; flex-shrink: 0; }
.wordmark { font-family: 'DM Serif Display', serif; font-size: 16px; color: var(--text); }

.icon-btn { background: none; border: none; color: var(--text2); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; transition: color .15s; }
.icon-btn:hover { color: var(--text); }

/* ── CONTENT ── */
.content { padding: 20px 20px 48px; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.content h2 { font-family: 'DM Serif Display', serif; font-size: 26px; font-weight: 400; margin-bottom: 4px; }
.sub { font-size: 13px; color: var(--text2); margin-bottom: 22px; }

/* ── SCAN ZONE ── */
.scan-zone {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  background: var(--bg3);
  border: 0.5px dashed var(--border2);
  border-radius: var(--r);
  padding: 16px 18px;
  cursor: pointer; margin-bottom: 14px;
  transition: border-color .2s;
}
.scan-zone:hover { border-color: var(--accent); }
.scan-zone:hover .scan-icon-wrap { border-color: var(--accent); color: var(--accent); }
.scan-icon-wrap {
  width: 40px; height: 40px; border-radius: 8px;
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); flex-shrink: 0; transition: all .2s;
}
.scan-title { font-size: 14px; color: var(--text); margin-bottom: 2px; }
.scan-hint  { font-size: 12px; color: var(--text2); }

/* ── DIVIDER ── */
.divider { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; }
.divider::before, .divider::after { content: ''; flex: 1; height: .5px; background: var(--border); }
.divider span { font-size: 11px; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; }

/* ── INPUTS ── */
input, textarea {
  width: 100%; background: var(--bg3); border: .5px solid var(--border);
  border-radius: var(--rs); padding: 11px 14px;
  font-size: 14px; color: var(--text); font-family: 'DM Sans', sans-serif;
  font-weight: 300; outline: none; transition: border-color .2s;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text3); }
input:focus, textarea:focus { border-color: var(--border2); }
textarea { resize: none; min-height: 82px; line-height: 1.6; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.field-grid input { margin: 0; }
.span-2 { grid-column: span 2; }

.field-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin: 16px 0 8px; font-weight: 500; }

/* ── CHIPS ── */
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg3); border: .5px solid var(--border);
  border-radius: var(--rs); font-size: 13px; color: var(--text2);
  cursor: pointer; user-select: none; transition: all .15s;
}
.chip.selected { border-color: var(--accent); color: var(--accent); background: rgba(212,168,83,.06); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); flex-shrink: 0; transition: background .15s; }
.chip.selected .dot { background: var(--accent); }

/* ── BUTTONS ── */
.btn-primary {
  width: 100%; background: var(--accent); color: #0c0c0e;
  border: none; border-radius: var(--rs); padding: 14px;
  font-size: 14px; font-weight: 500; font-family: 'DM Sans', sans-serif;
  cursor: pointer; margin-top: 22px; letter-spacing: .02em;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-outline {
  width: 100%; background: transparent; color: var(--text2);
  border: .5px solid var(--border2); border-radius: var(--rs); padding: 12px;
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; margin-top: 12px; transition: color .15s, border-color .15s;
}
.btn-outline:hover { color: var(--text); }

/* ── ERROR ── */
.error-bar {
  background: rgba(224,85,85,.1); border: .5px solid rgba(224,85,85,.3);
  border-radius: var(--rs); padding: 10px 14px;
  font-size: 13px; color: var(--danger); margin: 12px 0 0;
}

/* ── LOADING ── */
#screen-loading { align-items: center; justify-content: center; }
.loading-wrap { text-align: center; position: relative; padding: 0 20px; }
.pulse-ring {
  width: 80px; height: 80px; border: 1px solid var(--accent);
  border-radius: 50%; margin: 0 auto;
  animation: pulse-out 1.6s ease-in-out infinite; opacity: 0;
}
.pulse-core {
  font-size: 24px; color: var(--accent);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  animation: breathe 1.6s ease-in-out infinite;
}
#loading-text { font-family: 'DM Serif Display', serif; font-size: 20px; margin: 24px 0 6px; }
.loading-sub { font-size: 13px; color: var(--text2); }

@keyframes pulse-out { 0% { transform: scale(.8); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes breathe  { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

/* ── MINI SPINNER (for card scan) ── */
.mini-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(212,168,83,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULTS ── */
.contact-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(212,168,83,.12); border: 1px solid rgba(212,168,83,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--accent); flex-shrink: 0;
}
.contact-name { font-size: 16px; font-weight: 500; margin-bottom: 2px; }
.contact-role { font-size: 13px; color: var(--text2); }
.saved-badge {
  font-size: 11px; color: var(--success);
  border: .5px solid rgba(76,175,125,.3); border-radius: 20px;
  padding: 4px 10px; background: rgba(76,175,125,.08);
}

.insights-card { background: var(--bg3); border: .5px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; }
.insights-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 500; margin-bottom: 8px; }
.insights-text  { font-size: 13px; color: var(--text2); line-height: 1.7; }

.tab-bar { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; padding-bottom: 2px; }
.tab-bar::-webkit-scrollbar { display: none; }
.msg-tab {
  white-space: nowrap; padding: 6px 16px; border-radius: 20px;
  font-size: 12px; border: .5px solid var(--border);
  color: var(--text2); cursor: pointer; background: transparent;
  font-family: inherit; transition: all .15s;
}
.msg-tab.active { background: var(--accent); color: #0c0c0e; border-color: var(--accent); font-weight: 500; }

.msg-card { background: var(--bg2); border: .5px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 10px; animation: fadeUp .3s ease both; }
.msg-type    { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); font-weight: 500; margin-bottom: 10px; }
.msg-subject { font-size: 12px; color: var(--text2); margin-bottom: 8px; font-style: italic; }
.msg-body    { font-size: 14px; line-height: 1.75; color: var(--text); white-space: pre-wrap; }

.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 7px 12px; background: var(--bg3); border: .5px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--text2);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.copy-btn:hover  { color: var(--text); border-color: var(--border2); }
.copy-btn.copied { color: var(--success); border-color: rgba(76,175,125,.4); }

/* ── LEADS ── */
.lead-card {
  background: var(--bg2); border: .5px solid var(--border); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s; animation: fadeUp .3s ease both;
}
.lead-card:hover { border-color: var(--border2); }
.lead-card-name { font-weight: 500; font-size: 15px; margin-bottom: 3px; }
.lead-card-meta { font-size: 12px; color: var(--text2); }
.lead-card-date { font-size: 11px; color: var(--text3); margin-top: 6px; }

.empty-state { text-align: center; color: var(--text3); font-size: 14px; padding: 48px 0; }

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