/* Tagg - Apple HIG dark, quiet orange/black/white. Tighter spacing and smaller type (v5). */
:root {
  /* Light is the default. Dark is [data-theme="dark"] below. */
  --bg: #f4f4f6;
  --bg-elev: #ffffff;
  --card: #ececf0;
  --card-2: #e2e2e7;
  --sep: rgba(0,0,0,0.09);
  --text: #1c1c1e;
  --text-2: #6c6c72;
  --text-3: #a0a0a6;
  --accent: #d9733d;
  --accent-2: #c2602b;
  --accent-soft: rgba(217,115,61,0.12);
  --topbar-bg: rgba(244,244,246,0.8);
  --tabbar-bg: rgba(250,250,251,0.86);
  --overlay: rgba(0,0,0,0.35);
  --chip-bg: rgba(0,0,0,0.05);
  --shadow: rgba(0,0,0,0.12);
  --map-line: rgba(0,0,0,0.14);
  --map-node: #ffffff;
  --map-text: #1c1c1e;
  --on-accent: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-elev: #151517;
  --card: #1e1e21;
  --card-2: #2b2b2f;
  --sep: rgba(255,255,255,0.08);
  --text: #f5f5f7;
  --text-2: #8b8b92;
  --text-3: #5d5d63;
  --accent-2: #e5954f;
  --topbar-bg: rgba(0,0,0,0.72);
  --tabbar-bg: rgba(28,28,30,0.82);
  --overlay: rgba(0,0,0,0.55);
  --chip-bg: rgba(255,255,255,0.08);
  --shadow: rgba(0,0,0,0.5);
  --map-line: rgba(255,255,255,0.14);
  --map-node: #2c2c2e;
  --map-text: #ffffff;
  --on-accent: #0a0a0b;
}
/* The brand card and answer panel stay dark in both themes. */
.taggcard, .answer { --text:#f5f5f7; --text-2:#9a9aa1; --text-3:#6d6d73; --sep: rgba(255,255,255,0.1); --chip-bg: rgba(255,255,255,0.08); --accent-2:#e5954f; color: var(--text); }
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { height:100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height:100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}
@media (min-width: 560px) {
  #app { border-left: 1px solid var(--sep); border-right: 1px solid var(--sep); }
}

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 9px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.wordmark {
  display:flex; align-items:center; gap:10px;
  font-size: 18px; font-weight: 650; letter-spacing: -0.3px;
}
.wordmark .mark { width: 30px; height: 30px; border-radius: 8px; display:block; }
.bell { position: absolute; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 9px); width: 40px; height: 40px; display:flex; align-items:center; justify-content:center; color: var(--text); border-radius: 20px; }
.bell:active { background: var(--fill, rgba(120,120,128,.16)); }
.bellbadge { position:absolute; top:3px; right:2px; min-width:17px; height:17px; padding:0 4px; border-radius:9px; background:#d9733d; color:#fff; font-size:11px; font-weight:650; line-height:17px; text-align:center; }
.udot { display:inline-block; width:8px; height:8px; border-radius:4px; background:#d9733d; margin-right:8px; vertical-align:1px; }
.topbar .sub { color: var(--text-2); font-size: 12px; margin-top: 1px; margin-left: 40px; }

/* ---------- content ---------- */
.content { flex: 1; padding: 18px 20px; padding-bottom: 104px; animation: fadeUp .34s cubic-bezier(.22,.9,.3,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px);} to { opacity:1; transform:none;} }

h1.largetitle { font-size: 24px; font-weight: 650; letter-spacing:-0.5px; margin: 6px 0 4px; }
p.lead { color: var(--text-2); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
h2.section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); margin: 26px 4px 8px; }

/* ---------- grouped list (iOS inset) ---------- */
.group { background: var(--bg-elev); border-radius: var(--radius); overflow: hidden; }
.row {
  display:flex; align-items:center; gap:14px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--sep);
  text-decoration: none; color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.row:last-child { border-bottom: none; }
.row:active { background: var(--card); }
.row .grow { flex:1; min-width:0; }
.row .title { font-size: 14px; font-weight: 500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .detail { font-size: 12px; color: var(--text-2); margin-top: 1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chevron { color: var(--text-3); flex:none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex:none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#0a0a0b; font-weight:650; font-size:15px;
  display:flex; align-items:center; justify-content:center;
}
.avatar.mono { background: var(--card-2); color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding: 12px 16px;
  border:none; border-radius: 14px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor:pointer; text-decoration:none;
  transition: transform .12s, opacity .15s, background .15s;
  user-select:none;
}
.btn:active { transform: scale(0.97); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.btn-tinted { background: var(--accent-soft); color: var(--accent-2); }
.btn-gray { background: var(--card); color: var(--text); }
.btn-plain { background: transparent; color: var(--accent-2); }
.btn.small { width:auto; padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.btn + .btn { margin-top: 10px; }
.btnrow { display:flex; gap:10px; }
.btnrow .btn { flex:1; }
.btnrow .btn + .btn { margin-top:0; }

/* ---------- card preview ---------- */
.taggcard {
  border-radius: 22px;
  background: linear-gradient(160deg, #171717 0%, #000 60%);
  border: 1px solid rgba(255,107,26,0.35);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(255,107,26,0.12);
}
.taggcard::before {
  content:""; position:absolute; top:-60px; right:-60px; width:190px; height:190px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,107,26,0.28), transparent 70%);
}
.taggcard .tc-mark { font-size:13px; font-weight:800; letter-spacing:.18em; color:var(--accent-2); text-transform:uppercase; }
.taggcard .tc-name { font-size: 20px; font-weight: 650; letter-spacing:-0.4px; margin-top: 10px; }
.taggcard .tc-head { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height:1.4; }
.taggcard .tc-links { display:flex; flex-wrap:wrap; gap:8px; margin-top: 12px; position:relative; }
.chip {
  display:inline-flex; align-items:center; gap:6px;
  background: var(--chip-bg);
  border: 0.5px solid var(--sep);
  color: var(--text);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; font-weight: 500; text-decoration:none;
  transition: background .15s;
}
.chip:active { background: var(--sep); }
.chip svg { flex:none; }

/* ---------- QR ---------- */
.qrwrap {
  background:#fff; border-radius: 20px; padding: 16px;
  display:flex; flex-direction:column; align-items:center;
  box-shadow: 0 12px 44px rgba(255,107,26,0.22);
}
.qrwrap img, .qrwrap canvas { width:100%; max-width: 210px; height:auto; image-rendering: pixelated; border-radius: 6px; }
.qrcaption { text-align:center; color: var(--text-2); font-size: 14px; margin-top: 12px; line-height: 1.5; }
.qrcaption b { color: var(--text); font-weight:600; }

/* ---------- forms ---------- */
.field { margin-bottom: 4px; }
.field label { display:block; font-size:12px; font-weight:600; color:var(--text-2); margin: 14px 4px 6px; }
.input, textarea.input {
  width:100%; background: var(--bg-elev); border: 0.5px solid var(--sep);
  border-radius: var(--radius-sm); padding: 11px 14px;
  color: var(--text); font-family: var(--font); font-size: 16px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 72px; line-height:1.45; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width:100%; max-width: 520px; z-index: 30;
  display:flex;
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
  padding: 9px 0 7px;
  color: var(--text-2); text-decoration:none; font-size: 10.5px; font-weight: 600;
  transition: color .15s;
}
.tab.active { color: var(--accent-2); }
.tab svg { display:block; }

/* ---------- sheet / modal ---------- */
.sheet-bg {
  position: fixed; inset:0; z-index: 50;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display:flex; align-items:flex-end; justify-content:center;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
.sheet {
  width:100%; max-width: 520px;
  background: var(--bg-elev);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  animation: slideUp .32s cubic-bezier(.22,.9,.3,1);
  max-height: 86vh; overflow-y:auto;
}
@keyframes slideUp { from { transform: translateY(60px); opacity:.4;} to { transform:none; opacity:1;} }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--card-2); margin: 0 auto 16px; }
.sheet h3 { font-size: 17px; font-weight: 650; letter-spacing:-0.3px; margin-bottom: 6px; }
.sheet p.hint { color: var(--text-2); font-size: 12.5px; line-height:1.5; margin-bottom: 14px; }

/* ---------- misc ---------- */
.empty { text-align:center; padding: 44px 24px; color: var(--text-2); }
.empty .glyph { margin: 0 auto 16px; width: 64px; height: 64px; border-radius: 18px; background: var(--bg-elev); display:flex; align-items:center; justify-content:center; }
.empty .t { color: var(--text); font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty .d { font-size: 14px; line-height: 1.5; }
.pill {
  display:inline-block; background: var(--accent-soft); color: var(--accent-2);
  font-size: 12px; font-weight: 700; letter-spacing:.04em;
  border-radius: 999px; padding: 4px 11px; text-transform: uppercase;
}
.metacard { background: var(--bg-elev); border-radius: var(--radius); padding: 16px; }
.metacard .k { font-size:12px; font-weight:600; color:var(--text-2); text-transform:uppercase; letter-spacing:.05em; }
.metacard .v { font-size:14.5px; margin-top:3px; line-height:1.45; }
.metagrid { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.answer {
  background: linear-gradient(160deg, #171717, #000);
  border: 1px solid rgba(255,107,26,0.3);
  border-radius: var(--radius); padding: 18px;
  font-size: 14.5px; line-height: 1.55;
}
.answer b { color: var(--accent-2); }
.toast {
  position: fixed; left:50%; bottom: 100px; transform: translateX(-50%);
  background: var(--card-2); color: var(--text);
  border-radius: 12px; padding: 11px 18px; font-size: 14px; font-weight: 500;
  z-index: 90; box-shadow: 0 8px 30px var(--shadow);
  animation: fadeUp .25s;
}
.recbar { display:flex; align-items:center; gap:12px; background:var(--card); border-radius: var(--radius-sm); padding: 12px 14px; }
.recdot { width:12px; height:12px; border-radius:50%; background:#ff453a; animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% {opacity:1} 50% {opacity:.35} }
.footer-note { text-align:center; color: var(--text-3); font-size: 12px; margin-top: 22px; line-height:1.5; }
.footer-note a { color: var(--text-2); }
.linklist a { color: var(--accent-2); text-decoration: none; }
.divider { height:0.5px; background: var(--sep); margin: 20px 0; }
.soon { color: var(--text-3); font-size: 12.5px; }

/* ---------- connections map ---------- */
.graphwrap { background: var(--bg-elev); border-radius: var(--radius); padding: 10px; }
.graphwrap canvas { display:block; margin: 0 auto; }

/* ---------- tab badge ---------- */
.tab { position: relative; }
.tabbadge {
  position: absolute; top: 6px; left: calc(50% + 2px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2.5px rgba(28,28,30,0.95);
}

/* small explanatory text with breathing room (used for verification and post-send notes) */
.fineprint { color: var(--text-2); font-size: 12.5px; line-height: 1.45; margin: 0 0 12px; }

/* v5: live-scan banner and location status */
.scanbanner { display:flex; align-items:center; gap:10px; background: var(--accent-soft); border: 0.5px solid rgba(217,115,61,.35); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.scanbanner .dot { width:8px; height:8px; border-radius:50%; background: var(--accent); animation: pulse 1.4s infinite; flex:none; }
.locstatus { font-size: 13px; color: var(--text-2); margin: 8px 4px 0; line-height: 1.45; }
.locstatus a { color: var(--accent-2); }

.themeseg { display:flex; gap:4px; background: var(--card); border-radius: 10px; padding: 3px; }
.themeseg button { flex:1; border:0; background:transparent; color: var(--text-2); font: 500 13px var(--font); padding: 7px 0; border-radius: 8px; cursor:pointer; }
.themeseg button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px var(--shadow); }
.btnrow + .btn { margin-top: 10px; }

.panel{background:var(--bg-elev);border:1px solid var(--sep);border-radius:var(--radius);padding:16px;margin:8px 0 12px}
.panel .input{background:var(--card)}
.graphctl{position:absolute;right:16px;top:16px;display:flex;flex-direction:column;gap:6px}.graphctl button{min-width:36px;height:36px;border-radius:10px;border:1px solid var(--sep);background:var(--bg-elev);color:var(--text);font:600 15px var(--font);cursor:pointer;padding:0 8px}.graphctl button:active{background:var(--card)}

/* chat */
.thread{display:flex;flex-direction:column;gap:8px;margin:10px 0 12px}
.bubble{max-width:86%;padding:10px 14px;border-radius:18px;font-size:15.5px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.bubble.me{align-self:flex-end;background:linear-gradient(135deg,var(--accent),var(--accent-2));color:var(--on-accent);border-bottom-right-radius:6px}
.bubble.tagg{align-self:flex-start;background:var(--bg-elev);border:1px solid var(--sep);border-bottom-left-radius:6px}
.composer{display:flex;gap:8px;align-items:center}
.composer .input{flex:1;min-width:0;border-radius:14px}
.composer .btn{width:auto;margin:0;padding:0 16px;min-height:44px}
.micbtn{padding:0 12px !important}
.micbtn.live{background:var(--accent-soft);color:var(--accent-2)}
.chatopts{display:flex;justify-content:space-between;align-items:center;margin:10px 2px 0;font-size:13.5px;color:var(--text-2)}
.chk{display:flex;gap:8px;align-items:center}
.linkbtn{background:none;border:0;color:var(--accent-2);font:inherit;cursor:pointer;padding:6px}
.tokenbox{background:var(--accent-soft);border-radius:12px;padding:12px;margin:0 0 12px}
.tokenbox code{display:block;word-break:break-all;font-size:12.5px;margin:8px 0;user-select:all}
.btn[disabled]{opacity:.45;cursor:default}
.avatar-img{border-radius:50%;object-fit:cover;background:var(--card-2);flex:none;display:block}
.linksec{background:var(--bg-elev);border:1.5px solid rgba(217,115,61,.5);border-radius:20px;padding:16px;margin:12px 0;box-shadow:0 1px 0 rgba(217,115,61,.12)}
.lsdot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent);margin-right:9px;vertical-align:1px}
.lstag{margin-left:auto;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-3)}
.resline{font-size:15px;font-weight:600;line-height:1.4;margin:6px 0 0}
.resline.sub{font-weight:400;color:var(--text-2);font-size:14px;margin-top:2px}
.ghcard{display:flex;gap:12px;align-items:center;text-decoration:none;color:inherit;padding:10px;border-radius:14px;background:var(--bg);border:1px solid var(--sep)}
.embedframe{width:100%;border:0;border-radius:14px;background:var(--bg);display:block}
.profhero{display:flex;align-items:center;gap:16px;margin:6px 0 14px;padding:18px;border-radius:24px;background:linear-gradient(145deg,#0a0a0b 0%,#1b1410 100%);border:1.5px solid var(--accent);color:#f5f5f7}
.profhero .avatar-img,.profhero .avatar{border:2.5px solid var(--accent)}
.ph-mark{font-size:11px;font-weight:800;letter-spacing:.18em;color:#e5954f}
.ph-name{font-size:26px;line-height:1.15;margin:3px 0 0;font-weight:700;letter-spacing:-.01em}
.ph-head{color:#c9c9ce;font-size:14px;margin-top:3px}
.ph-loc{color:#e5954f;font-size:13px;margin-top:4px}
.ph-text{min-width:0}
.metacard{border:1.5px solid rgba(217,115,61,.5)}
.lshead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.lstitle{font-weight:600;font-size:16px}
.lssub{color:var(--text-2);font-size:13px;word-break:break-all}
.lsline{font-size:14px;line-height:1.45;margin:4px 0}
.lsmute{color:var(--text-2)}
.prow{display:flex;gap:12px;font-size:13.5px;line-height:1.5;margin-top:4px}
.prow .pl{color:var(--text-2);width:64px;flex:none}
.prow .pv{flex:1;min-width:0;overflow-wrap:anywhere}
.ghrow{display:flex;gap:12px;align-items:center;margin-bottom:6px}
.xembed a{color:var(--accent-2);font-weight:600}
.lockbars{display:grid;gap:8px;margin:6px 0 12px}
.lockbars i{display:block;height:12px;border-radius:6px;background:var(--sep)}
.lockbars i:nth-child(2){width:78%}.lockbars i:nth-child(3){width:52%}

/* ---------- pending request bar (top of every screen) ---------- */
.reqbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding: 10px 20px; background: rgba(217,115,61,0.14); color: var(--text); text-decoration:none; font-size: 14px; border-bottom: 0.5px solid var(--sep); }
.reqbar .reqgo { color: var(--accent-2); font-weight: 650; }

/* ---------- laptop and desktop (900px and wider): sidebar navigation, wider content, centered dialogs ---------- */
@media (min-width: 900px) {
  #app { max-width: 1180px; display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  #app > .topbar { grid-column: 1 / 3; padding-left: 28px; padding-right: 28px; }
  #app > .reqbar { grid-column: 2; grid-row: 2; }
  #app > .content { grid-column: 2; grid-row: 3; padding: 26px 40px 56px; max-width: 920px; width: 100%; margin: 0; }
  #app:not(:has(.tabbar)) { grid-template-columns: minmax(0, 1fr); }
  #app:not(:has(.tabbar)) > .content { grid-column: 1; margin: 0 auto; }
  .tabbar { position: sticky; top: 70px; left: auto; bottom: auto; transform: none; grid-column: 1; grid-row: 2 / 4; align-self: start;
    width: auto; max-width: none; flex-direction: column; gap: 4px; padding: 22px 14px; border-top: 0; border-right: 0.5px solid var(--sep);
    background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; min-height: calc(100vh - 70px); }
  .tab { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: 15px; position: relative; }
  .tab:hover { background: var(--bg-elev); }
  .tab.active { background: rgba(217,115,61,0.12); }
  .tabbadge { position: static; margin-left: auto; }
  h1.largetitle { font-size: 30px; }
  p.lead { font-size: 14px; max-width: 640px; }
  .metagrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 24px; max-width: 480px; padding-bottom: 24px; }
  .graphwrap canvas { margin: 0 auto; }
}
/* Read more: on narrow screens the long LinkedIn sections start collapsed on the same page. */
.readmore-btn { margin: 4px 0 12px; width: 100%; }
@media (max-width: 899px) {
  .readmore:not(.open) { max-height: 150px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
}
@media (min-width: 900px) { .readmore-btn { display: none; } }
