/* Vercel-style components. Tokens come from theme.css. */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--fg); }

/* Basecoat's .btn-outline hovers to the blue --accent; override to the
   neutral grey the rest of the button set uses, matching this theme. */
.btn-outline:hover { background: var(--surface-hover); color: var(--fg); }

.btn-icon { width: 36px; padding: 0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }

/* ---------- input ---------- */
/* Text-field chrome only — Basecoat styles [role=switch] separately. */
.input:not([role="switch"]) {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--fg);
  width: 100%;
  transition: border-color .15s ease;
  font-family: inherit;
}
.input:not([role="switch"]):focus { outline: none; border-color: var(--fg); }
.input:not([role="switch"])::placeholder { color: var(--fg-3); }

.input-sm { height: 32px; padding: 0 10px; font-size: 13px; }

textarea.input {
  height: auto;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 20px;
  resize: vertical;
}

/* ---------- card / section ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-padded { padding: 20px 24px; }
.card-tight { padding: 14px 16px; }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  height: 36px;
  padding: 3px;
  gap: 2px;
}
.seg > button {
  height: 28px;
  width: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.seg > button:hover { color: var(--fg); }
.seg > button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); }

/* ---------- keyboard hint ---------- */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  background: var(--surface);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.badge-solid { background: var(--fg); color: var(--fg-inverse); border-color: transparent; }

/* ---------- divider ---------- */
.divider { height: 1px; background: var(--border); border: 0; }

/* ---------- link ---------- */
.link { color: var(--fg); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- focus ring (accessibility) ---------- */
.btn:focus-visible,
.input:focus-visible,
.seg > button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- nav item ---------- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  transition: background-color .15s ease, color .15s ease;
  text-decoration: none;
}
.nav-item:hover { background: #eaeaea; color: var(--fg); }
.nav-item[aria-current="page"],
.nav-item.is-active {
  background: #eaeaea;
  color: var(--fg);
}
.nav-item svg { flex-shrink: 0; }
.nav-item .nav-item-chev { margin-left: auto; color: var(--fg-3); }

/* ---------- button label↔spinner swap (HTMX in-flight) ---------- */
/* HTMX adds .htmx-request to the element issuing the request (the <form> for
   form submits, or the button itself for hx-post on a button). These rules
   swap the label↔spinner with no layout shift. */
.htmx-indicator-show { display: none; }
.htmx-request .htmx-indicator-hide { display: none !important; }
.htmx-request .htmx-indicator-show { display: inline-flex !important; align-items: center; gap: 0.5rem; }

/* ---------- page header ---------- */
/* One title, one line of explanation, closed by a hairline. This is the
   Market Research header (.loc-app-header) generalised: every workspace page
   opens the same way, so the metrics live here rather than per page. */
.page-head {
  min-height: 72px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-head h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 600;
  color: var(--fg);
}

.page-head p {
  max-width: 60ch;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
  text-wrap: pretty;
}

.page-head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .page-head {
    flex-direction: column;
    gap: 10px;
  }
}

/* ---------- SnapTrade connection portal ---------- */
/* Lives here, not in stocks.css: the portal dialog is served from one partial
   into both the connect page and the stocks dashboard, which load different
   page stylesheets. */

/* Width and height beat the UA's default dialog sizing, which caps at the
   viewport minus its own margins. */
.stk-portal-dialog {
  width: min(96vw, 1280px);
  max-width: none;
  padding: clamp(0.75rem, 2vw, 1.25rem);
}

/* Leaves room for the dialog's own padding on both edges. */
.stk-portal-frame {
  display: block;
  width: 100%;
  height: min(82vh, 940px);
  border: 0;
  border-radius: 12px;
}

.stk-error {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: #e11d48;
}

/* ---------- inbox row highlight (invite deep-link) ---------- */
/* Applied by inbox_deeplink.js to the invitation row an emailed link points
   at, then removed after a few seconds. */
.inbox-item-highlight {
  background: #fefce8;
  box-shadow: inset 2px 0 0 0 #eab308;
  transition: background-color .3s ease, box-shadow .3s ease;
}
