/* ============================================================
   Bid-Ness Center — mobile companion app
   Brand tokens from Design Package v1.0
   ============================================================ */
:root {
  --ink: #060A17;            /* app background */
  --surface: #0B1224;        /* sheets, bars, tab bar */
  --card: #101A33;           /* cards, list rows */
  --blue: #2E6BFF;
  --blue-hi: #4F8CFF;
  --grad-blue: linear-gradient(135deg, #2563EB, #4F8CFF);
  --violet: #A855F7;
  --grad-ai: linear-gradient(135deg, #7C5CFF, #A855F7);
  --cyan: #22D3EE;
  --green: #34D399;
  --amber: #F5B84C;
  --red: #F16A6A;
  --text: #F4F7FF;
  --text2: #8B96B8;
  --text-dis: rgba(139,150,184,0.45);
  --hairline: rgba(139,150,184,0.14);
  --hairline-2: rgba(139,150,184,0.1);
  --stroke: rgba(139,150,184,0.2);
  --gutter: 20px;
  --r-chip: 10px;
  --r-card: 16px;
  --r-sheet: 24px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(64px + var(--sab));
  --display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --ui: 'Manrope', 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  height: 100%;
  background: #04070F;
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.4667; /* 15/22 */
  overscroll-behavior-y: none;
}
img { max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
::selection { background: rgba(46,107,255,0.4); }

#app {
  position: fixed; inset: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--ink);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px var(--hairline), 0 30px 80px rgba(0,0,0,0.6); }
}

/* ---------- view container ---------- */
.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--ink);
  padding-top: var(--sat);
  animation: view-in 240ms cubic-bezier(0.25, 0.8, 0.35, 1);
}
.view.pop { animation: view-pop 220ms cubic-bezier(0.25, 0.8, 0.35, 1); }
@keyframes view-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes view-pop { from { transform: translateX(-18px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.view.root { animation: root-in 180ms ease; }
@keyframes root-in { from { opacity: 0.35; } to { opacity: 1; } }

.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.scroll.with-tabbar { padding-bottom: calc(var(--tabbar-h) + 16px); }

/* ---------- typography ---------- */
.t-display { font-family: var(--display); font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; }
.t-title   { font-family: var(--display); font-size: 26px; line-height: 30px; font-weight: 700; letter-spacing: -0.02em; }
.t-heading { font-size: 17px; line-height: 24px; font-weight: 700; }
.t-caption { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text2); }
.t-micro   { font-size: 10px; line-height: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text2); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--text2); }

/* ---------- header ---------- */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--gutter) 10px; gap: 12px; }
.hdr .greet { font-size: 13px; color: var(--text2); font-weight: 600; }
.hdr-back {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--gutter) 12px; min-height: 48px;
}
.hdr-back .label { font-size: 15px; font-weight: 700; color: var(--text2); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px;
  border-radius: 999px; background: var(--red);
  font-size: 10px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.avatar {
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; flex-shrink: 0; color: var(--text);
}
.avatar.me { background: linear-gradient(135deg, #2563EB, #7C5CFF); }

/* ---------- chips & pills ---------- */
.chip-row { display: flex; gap: 8px; padding: 0 var(--gutter) 12px; overflow-x: auto; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 16px; border-radius: 999px; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--stroke);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text2); white-space: nowrap;
}
.chip.on { background: var(--grad-blue); border-color: transparent; color: var(--text); }
.select-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--stroke);
  font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.select-pill .caret { color: var(--text2); }
.tag { font-size: 10px; font-weight: 800; border-radius: 999px; padding: 3px 9px; letter-spacing: 0.02em; white-space: nowrap; }
.tag.green  { color: var(--green);  background: rgba(52,211,153,0.12); }
.tag.blue   { color: var(--blue-hi); background: rgba(79,140,255,0.12); }
.tag.violet { color: var(--violet); background: rgba(168,85,247,0.12); }
.tag.amber  { color: var(--amber);  background: rgba(245,184,76,0.12); }
.tag.red    { color: var(--red);    background: rgba(241,106,106,0.12); }
.tag.cyan   { color: var(--cyan);   background: rgba(34,211,238,0.12); }
.tag.gray   { color: var(--text2);  background: rgba(139,150,184,0.12); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 16px; }
.card.pad-sm { padding: 14px 16px; }
.section-label { font-size: 12px; font-weight: 800; color: var(--text2); letter-spacing: 0.06em; }
.ai-card { border-radius: var(--r-card); padding: 1.5px; background: var(--grad-ai); }
.ai-card > .inner { background: #0C1128; border-radius: 14.5px; padding: 14px 16px; }
.ai-chip-btn {
  height: 34px; padding: 0 16px; border-radius: 999px;
  background: rgba(168,85,247,0.18); border: 1px solid rgba(168,85,247,0.4);
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; color: #C9A7F7;
}
.ghost-chip-btn {
  height: 34px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(139,150,184,0.25);
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; color: var(--text2);
  background: none;
}

/* ---------- buttons ---------- */
.btn-primary {
  height: 52px; border-radius: 999px; background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--text); width: 100%;
  box-shadow: 0 10px 26px rgba(46,107,255,0.4);
}
.btn-primary:active, .chip:active, .icon-btn:active, .row:active, .menu-row:active { opacity: 0.75; }
.btn-secondary {
  height: 52px; border-radius: 999px; border: 1px solid rgba(139,150,184,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--text2); width: 100%;
}
.btn-dashed {
  height: 52px; border-radius: 999px; border: 1.5px dashed rgba(139,150,184,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--text2); width: 100%;
}
.btn-sm-primary {
  height: 38px; padding: 0 18px; border-radius: 999px; background: var(--grad-blue);
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; color: var(--text);
}

/* ---------- toggle ---------- */
.toggle { width: 46px; height: 28px; border-radius: 999px; background: rgba(139,150,184,0.25); position: relative; flex-shrink: 0; transition: background 180ms; border: none; }
.toggle .knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 999px; background: #fff; transition: transform 180ms; }
.toggle.on { background: var(--grad-blue); }
.toggle.on.ai { background: var(--grad-ai); }
.toggle.on .knob { transform: translateX(18px); }

/* ---------- list rows ---------- */
.row { display: flex; gap: 12px; padding: 14px var(--gutter); border-top: 1px solid var(--hairline-2); align-items: flex-start; width: 100%; text-align: left; min-height: 64px; }
.row.center { align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.row .title-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row .name { font-size: 15px; font-weight: 800; }
.row .preview { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .preview.unread { color: #C9D2EA; }
.unread-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--blue-hi); margin-top: 6px; flex-shrink: 0; }

/* ---------- tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(11,18,36,0.96);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline);
  padding: 10px 6px calc(10px + var(--sab));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; }
.tab .lbl { font-size: 10px; font-weight: 700; color: var(--text2); letter-spacing: 0.02em; }
.tab.on .lbl { color: var(--blue-hi); }

/* ---------- FAB ---------- */
.fab {
  position: absolute; right: 20px; bottom: calc(var(--tabbar-h) + 20px); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px rgba(46,107,255,0.45);
  font-size: 26px; color: #fff;
}

/* ---------- KPI grid ---------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 var(--gutter); }
.kpi { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 14px 16px; text-align: left; }
.kpi .k-label { font-size: 11px; font-weight: 700; color: var(--text2); letter-spacing: 0.06em; }
.kpi .k-value { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-delta { font-size: 11px; font-weight: 700; margin-top: 2px; }

/* ---------- search bar ---------- */
.searchbar {
  margin: 0 var(--gutter); height: 48px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--stroke);
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
}
.searchbar input { flex: 1; background: none; border: none; outline: none; font-size: 14px; }
.searchbar input::placeholder { color: var(--text2); }

/* ---------- login ---------- */
.login-view { display: flex; flex-direction: column; padding: calc(var(--sat) + 40px) 24px calc(var(--sab) + 32px); height: 100%; }
.login-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.login-hero img.appicon { width: 96px; height: 96px; border-radius: 24px; border: 1px solid rgba(79,140,255,0.3); box-shadow: 0 20px 50px rgba(46,107,255,0.35); margin-bottom: 28px; }
.field {
  height: 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--stroke);
  display: flex; align-items: center; padding: 0 18px; font-size: 15px; gap: 10px;
}
.field input { flex: 1; background: none; border: none; outline: none; letter-spacing: normal; min-width: 0; }
.field .show-btn { font-size: 13px; color: var(--blue-hi); font-weight: 600; }
.field-error { font-size: 12px; color: var(--red); font-weight: 600; padding: 2px 6px 0; display: none; }
.field-error.show { display: block; }

/* ---------- conversation ---------- */
.bubble { max-width: 78%; padding: 11px 14px; font-size: 14px; line-height: 1.45; }
.bubble.them { align-self: flex-start; background: var(--card); border: 1px solid var(--hairline); border-radius: 18px 18px 18px 6px; }
.bubble.me { align-self: flex-end; background: var(--grad-blue); border-radius: 18px 18px 6px 18px; }
.bubble-meta { align-self: flex-end; font-size: 10px; color: var(--text2); font-weight: 600; margin-top: -4px; }
.day-divider { align-self: center; font-size: 10px; font-weight: 700; color: var(--text2); letter-spacing: 0.08em; }
.composer {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(12px + var(--sab));
  border-top: 1px solid var(--hairline); background: rgba(11,18,36,0.96);
}
.composer .input {
  flex: 1; height: 42px; border-radius: 999px; background: var(--card); border: 1px solid var(--stroke);
  display: flex; align-items: center; padding: 0 16px;
}
.composer .input input { flex: 1; background: none; border: none; outline: none; font-size: 14px; }
.composer .send {
  width: 42px; height: 42px; border-radius: 999px; background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.composer .attach {
  width: 38px; height: 38px; border-radius: 999px; background: var(--card); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text2); flex-shrink: 0;
}

/* ---------- pipeline ---------- */
.kanban { display: flex; gap: 12px; padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; flex: 1; scrollbar-width: none; align-items: flex-start; }
.kanban::-webkit-scrollbar { display: none; }
.stage-col { width: min(292px, 78vw); flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start; padding-bottom: 12px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.page-dots { display: flex; justify-content: center; gap: 6px; padding: 12px 0; }
.page-dots .dot { width: 6px; height: 6px; border-radius: 999px; background: rgba(139,150,184,0.35); transition: all 200ms; }
.page-dots .dot.on { width: 18px; background: var(--blue-hi); }

/* ---------- stage stepper ---------- */
.stepper { display: flex; gap: 5px; }
.stepper .seg { flex: 1; height: 7px; border-radius: 999px; background: rgba(139,150,184,0.2); }
.stepper .seg.done { background: var(--green); }
.stepper .seg.now { background: linear-gradient(90deg, #2563EB, #4F8CFF); }

/* ---------- calendar ---------- */
.week-strip { display: flex; padding: 0 var(--gutter) 12px; align-items: flex-start; }
.day-cell { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; }
.day-cell .d { width: 38px; height: 38px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.day-cell.sel .d { background: var(--grad-blue); font-weight: 800; }
.day-cell .evdot { width: 5px; height: 5px; border-radius: 999px; }
.event-row { display: flex; gap: 12px; margin-bottom: 10px; width: 100%; text-align: left; }
.event-row .time { width: 44px; font-size: 12px; font-weight: 700; color: var(--text2); text-align: right; padding-top: 12px; flex-shrink: 0; }
.event-card { flex: 1; background: var(--card); border-radius: 12px; padding: 12px 14px; border-left: 3px solid var(--blue-hi); }
.event-card.held { background: rgba(16,26,51,0.5); border: 1.5px dashed rgba(139,150,184,0.3); border-left: 1.5px dashed rgba(139,150,184,0.3); }
.slot-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.slot { height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--stroke); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--text2); }
.slot.sel { background: rgba(79,140,255,0.15); border: 1.5px solid var(--blue-hi); color: var(--blue-hi); font-weight: 800; }
.slot.gone { background: rgba(16,26,51,0.4); border: none; color: rgba(139,150,184,0.4); text-decoration: line-through; }

/* ---------- more menu ---------- */
.menu-group { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%; text-align: left; min-height: 48px; }
.menu-row + .menu-row { border-top: 1px solid var(--hairline-2); }
.menu-row .lbl { flex: 1; font-size: 14px; font-weight: 700; }
.count-badge { min-width: 20px; height: 20px; border-radius: 999px; background: var(--red); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; color: #fff; }
.new-pill { font-size: 10px; font-weight: 800; color: #fff; background: var(--grad-blue); border-radius: 999px; padding: 3px 9px; }
.new-pill.ai { background: var(--grad-ai); }

/* ---------- sheets / toast ---------- */
.sheet-veil { position: absolute; inset: 0; z-index: 40; background: rgba(2,4,10,0.6); animation: fade 160ms; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 10px 20px calc(24px + var(--sab));
  animation: sheet-up 240ms cubic-bezier(0.25, 0.8, 0.35, 1);
  border-top: 1px solid var(--hairline);
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0.5; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 999px; background: rgba(139,150,184,0.3); margin: 4px auto 14px; }
.sheet-row { display: flex; align-items: center; gap: 12px; padding: 14px 4px; width: 100%; text-align: left; font-size: 15px; font-weight: 700; border-top: 1px solid var(--hairline-2); }
.sheet-row:first-of-type { border-top: none; }

#toast {
  position: absolute; left: 50%; transform: translateX(-50%) translateY(8px);
  bottom: calc(var(--tabbar-h) + 18px); z-index: 60;
  background: #1A2749; border: 1px solid var(--stroke); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms;
  max-width: 86%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- success overlay ---------- */
.success-veil {
  position: absolute; inset: 0; z-index: 50; background: rgba(4,7,15,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  animation: fade 200ms;
}
.success-ring {
  width: 96px; height: 96px; border-radius: 999px; background: rgba(52,211,153,0.12);
  border: 2px solid var(--green); display: flex; align-items: center; justify-content: center;
  animation: pop-in 320ms cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop-in { from { transform: scale(0.5); opacity: 0; } }

/* ---------- misc ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.mx { margin-left: var(--gutter); margin-right: var(--gutter); }
.donut { width: 92px; height: 92px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.donut .hole { width: 56px; height: 56px; border-radius: 999px; background: var(--card); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 17px; font-weight: 700; }
.act-dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 5px; flex-shrink: 0; }
.hero-tiles { display: flex; gap: 10px; padding: 18px var(--gutter) 0; }
.hero-tile { flex: 1; height: 60px; border-radius: var(--r-card); background: var(--card); border: 1px solid var(--hairline); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.hero-tile span { font-size: 11px; font-weight: 700; color: var(--text2); }
.step-icon { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.step-line { width: 1.5px; height: 14px; background: rgba(139,150,184,0.3); margin-left: 15px; }
.check-circle { width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid var(--blue-hi); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.check-circle.dim { border-color: rgba(139,150,184,0.4); }
.check-circle.done { background: var(--green); border-color: var(--green); }
