/* TrueCFO UI glue styles (Basecoat-first)
 *
 * Keep this file small. Prefer Basecoat primitives in templates.
 * Use this only for:
 * - layout wrappers shared across pages
 * - one-off compatibility fixes
 */

/* Make native controls aware we support both schemes (dark compatibility without a toggle). */
:root {
  color-scheme: light dark;
}

/* Convenience helpers (keep minimal; prefer Basecoat primitives). */
.btn-block {
  width: 100%;
  justify-content: center;
}

/* Shared layout primitives for standalone templates (prefixed to avoid collisions). */
.tcfo-page {
  min-height: 100vh;
  padding: 40px 20px 60px;
  background: var(--color-background);
  color: var(--color-foreground);
}

.tcfo-container {
  max-width: 960px;
  margin: 0 auto;
}

.tcfo-container-xl {
  max-width: 1200px;
  margin: 0 auto;
}

.tcfo-container-sm {
  max-width: 720px;
  margin: 0 auto;
}

.tcfo-container-xs {
  max-width: 520px;
  margin: 0 auto;
}

.tcfo-header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tcfo-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.tcfo-row-between {
  justify-content: space-between;
}

.tcfo-row-end {
  justify-content: flex-end;
}

.tcfo-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tcfo-shell-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tcfo-shell-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tcfo-shell-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tcfo-shell-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tcfo-shell-kicker {
  margin: 0;
  color: var(--color-muted-foreground);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tcfo-shell-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-muted-foreground);
  font-size: 12px;
}

.tcfo-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-primary);
}

.tcfo-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.tcfo-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  font-weight: 700;
}

.tcfo-brand-wordmark {
  display: inline-flex;
  flex-direction: column;
}

.tcfo-brand-name {
  font-weight: 700;
}

.tcfo-brand-sub {
  color: var(--color-muted-foreground);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tcfo-title {
  margin: 0;
  font-size: 22px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

.tcfo-subtitle {
  margin: 0;
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  line-height: var(--tw-leading, var(--text-sm--line-height));
}

.tcfo-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

.tcfo-grow {
  flex: 1;
  min-width: 240px;
}

.tcfo-row-center {
  justify-content: center;
}

.tcfo-center {
  text-align: center;
}

.tcfo-home-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 24px;
}

.tcfo-home-card,
.tcfo-home-side {
  padding: 24px;
}

.tcfo-home-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tcfo-home-points li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
}

.tcfo-progress {
  width: 100%;
}

/* Grid layout for card collections (ex: tenant selection). */
.tcfo-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.tcfo-selectable-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tcfo-selectable-card:hover {
  border-color: var(--color-ring);
  transform: translateY(-1px);
}

.tcfo-selectable-card.selected {
  border-color: var(--color-primary);
}

.tenant-radio {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Choice cards (ex: Plaid account selector). */
.tcfo-choice-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  background: var(--color-card);
  color: var(--color-card-foreground);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.tcfo-choice-card:hover {
  border-color: var(--color-ring);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.tcfo-choice-card:has(input:checked) {
  border-color: var(--color-primary);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.tcfo-choice-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-primary);
}

/* Small inline spinner used in button loading states. */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--color-primary);
  border-radius: 999px;
  animation: tcfo-spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

.dark .loading-spinner {
  border-color: rgba(255, 255, 255, 0.22);
  border-top-color: var(--color-primary);
}

@keyframes tcfo-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Lightweight text helpers (existing templates used these class names). */
.muted,
.tcfo-text-muted {
  color: var(--color-muted-foreground);
}

.error,
.tcfo-text-error {
  color: var(--color-destructive);
}

.success,
.tcfo-text-success {
  color: var(--color-primary);
}

/* List item pattern: "card-like" row with actions on the right. */
.tcfo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tcfo-list-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--color-card);
  color: var(--color-card-foreground);
}

.tcfo-list-item.tcfo-list-item--muted {
  color: var(--color-muted-foreground);
}

/* Alerts with dismiss buttons (Basecoat has `.alert` already; we only position the close button). */
.alert.tcfo-closable,
.alert-destructive.tcfo-closable {
  padding-right: calc(var(--spacing) * 10);
}

.tcfo-alert-close {
  position: absolute;
  top: calc(var(--spacing) * 2);
  right: calc(var(--spacing) * 2);
}

.fade-out {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 600px) {
  .tcfo-shell-header {
    flex-direction: column;
  }

  .tcfo-home-shell {
    grid-template-columns: 1fr;
  }

  .tcfo-page {
    padding: 28px 16px 44px;
  }
}
