/* ═══════════════════════════════════════════════════════════════
   AssetFlow × Tabler 1.7.5 — Phase 2.1 prototype design system
   Standalone only. No Laravel / DB wiring.
═══════════════════════════════════════════════════════════════ */

:root,
[data-bs-theme="dark"] {
  --af-bg: #0b0f19;
  --af-bg-elevated: #0f1623;
  --af-surface: #151b2b;
  --af-surface-hover: #1a2235;
  --af-surface-raised: #1e2840;
  --af-primary: #3b82f6;
  --af-primary-600: #2563eb;
  --af-success: #10b981;
  --af-warning: #f59e0b;
  --af-danger: #ef4444;
  --af-text: #f8fafc;
  --af-text-body: #cbd5e1;
  --af-text-muted: #94a3b8;
  --af-text-faint: #8a9bbb;
  --af-border: rgba(148, 163, 184, 0.12);
  --af-radius: 14px;
  --af-sidebar-width: 260px;
  --af-header-h: 56px;
  --af-bottom-nav-h: 64px;

  --tblr-body-bg: var(--af-bg);
  --tblr-bg-surface: var(--af-surface);
  --tblr-bg-surface-secondary: var(--af-bg-elevated);
  --tblr-bg-surface-tertiary: var(--af-surface-hover);
  --tblr-primary: var(--af-primary);
  --tblr-primary-rgb: 59, 130, 246;
  --tblr-primary-fg: #fff;
  --tblr-success: var(--af-success);
  --tblr-warning: var(--af-warning);
  --tblr-danger: var(--af-danger);
  --tblr-border-color: var(--af-border);
  --tblr-body-color: var(--af-text-body);
  --tblr-secondary: var(--af-text-muted);
  --tblr-muted: var(--af-text-faint);
  --tblr-font-sans-serif: "Inter", system-ui, -apple-system, sans-serif;
  --tblr-font-monospace: "JetBrains Mono", ui-monospace, monospace;
  --tblr-navbar-bg: var(--af-bg-elevated);
  --tblr-navbar-border-color: var(--af-border);
  --tblr-card-bg: var(--af-surface);
}

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

html {
  background: var(--af-bg);
  overflow-x: hidden;
}

body {
  background: var(--af-bg) !important;
  color: var(--af-text-body);
  font-family: "Inter", system-ui, sans-serif;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--af-primary); }
a:hover { color: #60a5fa; }

/* ── Typography helpers ─────────────────────────────────────── */
.af-mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.af-brand {
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--af-text) !important;
  text-decoration: none;
}

.af-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.af-brand-mark::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--af-primary), var(--af-primary-600));
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.af-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--af-text-faint);
}

.af-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--af-text);
  margin: 0;
}

.af-page-sub {
  color: var(--af-text-muted);
  font-size: 0.925rem;
  margin: 0.25rem 0 0;
}

/* ── Buttons ────────────────────────────────────────────────── */
.af-btn-primary {
  background: var(--af-primary) !important;
  border-color: var(--af-primary) !important;
  color: #fff !important;
  font-weight: 600;
}
.af-btn-primary:hover,
.af-btn-primary:focus {
  background: var(--af-primary-600) !important;
  border-color: var(--af-primary-600) !important;
  color: #fff !important;
}

.af-btn-ghost {
  background: transparent !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  color: #e2e8f0 !important;
}
.af-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #fff !important;
}

.af-btn-success {
  background: var(--af-success) !important;
  border-color: var(--af-success) !important;
  color: #04110c !important;
  font-weight: 600;
}

/* ── Cards / stats ──────────────────────────────────────────── */
.af-card {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
}

.af-card-pad { padding: 1.25rem; }

.af-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--af-text-faint);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.af-stat-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--af-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.af-stat-delta-up { color: var(--af-success); }
.af-stat-delta-down { color: #f87171; }

.af-stat-foot {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--af-text-muted);
}

/* ── Tables ─────────────────────────────────────────────────── */
.af-table {
  --tblr-table-bg: transparent;
  margin-bottom: 0;
}
.af-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--af-text-faint) !important;
  font-weight: 600;
  border-bottom-color: var(--af-border) !important;
  white-space: nowrap;
}
.af-table td {
  border-bottom-color: rgba(148, 163, 184, 0.08) !important;
  vertical-align: middle;
}
.af-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Badges / status ────────────────────────────────────────── */
.af-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}
.af-badge-credit { background: rgba(16, 185, 129, 0.15); color: var(--af-success); }
.af-badge-debit { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.af-badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--af-warning); }
.af-badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.af-badge-neutral { background: rgba(148, 163, 184, 0.12); color: var(--af-text-muted); }

/* ── Prototype banner ───────────────────────────────────────── */
.af-proto-banner {
  background: var(--af-surface-raised);
  border-bottom: 1px solid var(--af-border);
  font-size: 0.78rem;
  color: var(--af-text-muted);
  position: sticky;
  top: 0;
  z-index: 1100;
}
.af-proto-banner a { color: #93c5fd; text-decoration: none; }
.af-proto-banner a:hover { text-decoration: underline; }

/* ── Public site ────────────────────────────────────────────── */
.af-nav-public {
  background: rgba(15, 22, 35, 0.92) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--af-border);
}
.af-nav-public .nav-link {
  color: var(--af-text-muted) !important;
  font-weight: 500;
  font-size: 0.9rem;
}
.af-nav-public .nav-link:hover,
.af-nav-public .nav-link.active {
  color: var(--af-text) !important;
}

/* Marketing / public landing hero only — must not target dashboard .cw-wallet-hero.af-hero */
.af-hero:not(.cw-wallet-hero) {
  position: relative;
  min-height: min(82vh, 720px);
  display: flex;
  align-items: center;
  background:
    radial-gradient(ellipse 70% 55% at 78% 18%, rgba(59, 130, 246, 0.16), transparent 58%),
    radial-gradient(ellipse 45% 40% at 8% 88%, rgba(37, 99, 235, 0.1), transparent 52%),
    var(--af-bg);
  border-bottom: 1px solid var(--af-border);
  overflow: hidden;
}

.af-hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--af-text);
  max-width: 11ch;
  line-height: 1.05;
  margin: 0 0 1rem;
}

.af-hero-lead {
  max-width: 34rem;
  color: var(--af-text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.af-section {
  padding: 4.25rem 0;
}
.af-section-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--af-text);
  margin: 0 0 0.5rem;
}
.af-section-lead {
  color: var(--af-text-muted);
  max-width: 38rem;
  margin-bottom: 1.75rem;
}

.af-footer {
  border-top: 1px solid var(--af-border);
  padding: 2.5rem 0 2rem;
  background: var(--af-bg-elevated);
}
.af-footer a {
  color: var(--af-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}
.af-footer a:hover { color: var(--af-text); }

/* ── App shell (user + admin) ───────────────────────────────── */
.af-app {
  display: flex;
  min-height: 100vh;
  background: var(--af-bg);
}

.af-sidebar {
  width: var(--af-sidebar-width);
  flex-shrink: 0;
  background: var(--af-bg-elevated);
  border-right: 1px solid var(--af-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1030;
  overflow: hidden;
}

.af-sidebar-brand {
  height: var(--af-header-h);
  display: flex;
  align-items: center;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--af-border);
}

.af-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.af-sidebar-nav .nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--af-text-faint);
  font-weight: 600;
  padding: 0.75rem 0.65rem 0.35rem;
}

.af-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--af-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
  transition: background 150ms ease, color 150ms ease;
}
.af-sidebar-nav a i {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}
.af-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--af-text);
}
.af-sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.14);
  color: #fff;
}
.af-sidebar-nav a.active i { color: var(--af-primary); }

.af-sidebar-foot {
  border-top: 1px solid var(--af-border);
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  color: var(--af-text-faint);
}

.af-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--af-bg);
}

.af-topbar {
  height: var(--af-header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  background: rgba(15, 22, 35, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--af-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.af-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--af-border);
  background: transparent;
  color: var(--af-text-muted);
  position: relative;
}
.af-icon-btn:hover {
  color: var(--af-text);
  background: rgba(255, 255, 255, 0.04);
}
.af-icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--af-primary);
  border: 1.5px solid var(--af-bg-elevated);
}

.af-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1e3a5f, #2563eb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.af-content {
  padding: 1.25rem 1.25rem 2rem;
  flex: 1;
}

.af-content-inner {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.af-content-wide {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* Method cards */
.af-method {
  border: 1px solid var(--af-border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--af-bg-elevated);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  height: 100%;
}
.af-method:hover,
.af-method.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}
.af-method-title {
  color: var(--af-text);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.af-method-meta {
  color: var(--af-text-muted);
  font-size: 0.8rem;
}

/* Forms */
.af-form .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--af-text-muted);
}
.af-form .form-control,
.af-form .form-select {
  background: var(--af-bg-elevated);
  border-color: var(--af-border);
  color: var(--af-text);
}
.af-form .form-control:focus,
.af-form .form-select:focus {
  background: var(--af-bg-elevated);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
  color: var(--af-text);
}
.af-form .form-hint {
  color: var(--af-text-faint);
  font-size: 0.75rem;
}

/* Mobile bottom nav (user) */
.af-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  background: rgba(15, 22, 35, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--af-border);
  padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
}
.af-bottom-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.af-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 52px;
  color: var(--af-text-faint);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 10px;
}
.af-bottom-nav a i { font-size: 1.2rem; }
.af-bottom-nav a.active { color: var(--af-primary); background: rgba(59, 130, 246, 0.1); }

.af-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1025;
}

/* Dropdown polish */
.dropdown-menu {
  background: var(--af-surface) !important;
  border: 1px solid var(--af-border) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.dropdown-item { color: var(--af-text-body) !important; }
.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--af-text) !important;
}

/* Admin accent rail */
.af-admin .af-sidebar-brand .af-brand span.tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--af-primary);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.35rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .af-hero:not(.cw-wallet-hero) { min-height: 68vh; }

  .af-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
  }
  body.af-sidebar-open .af-sidebar {
    transform: translateX(0);
  }
  body.af-sidebar-open .af-sidebar-backdrop {
    display: block;
  }

  .af-bottom-nav { display: block; }
  .af-content {
    padding-bottom: calc(var(--af-bottom-nav-h) + 1.5rem + env(safe-area-inset-bottom, 0px));
  }
  .af-admin .af-bottom-nav { display: none; }
  .af-admin .af-content { padding-bottom: 1.5rem; }
}

@media (max-width: 575.98px) {
  .af-stat-value { font-size: 1.25rem; }
  .af-content { padding-left: 0.9rem; padding-right: 0.9rem; }
  .af-topbar { padding-left: 0.85rem; padding-right: 0.85rem; }
}

/* ══ Laravel AF theme bridge — Theme4 compatibility ═══════════ */
body.af-ui {
  background: var(--af-bg) !important;
  color: var(--af-text-body);
}
.af-dash-shell {
  display: flex;
  min-height: 100vh;
  background: var(--af-bg);
}
.af-dash-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--af-bg);
}
.dashboard-body-part {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 1.25rem 2rem;
  box-sizing: border-box;
}
.af-card {
  background: var(--af-surface) !important;
  border: 1px solid var(--af-border) !important;
  border-radius: var(--af-radius) !important;
  color: var(--af-text-body);
}
.af-btn-primary, .btn.af-btn-primary, .btn-primary {
  background: var(--af-primary) !important;
  border-color: var(--af-primary) !important;
  color: #fff !important;
}
.btn-primary:hover, .af-btn-primary:hover {
  background: var(--af-primary-600) !important;
  border-color: var(--af-primary-600) !important;
}
.form-control, .form-select {
  background-color: var(--af-bg-elevated);
  border-color: var(--af-border);
  color: var(--af-text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--af-bg-elevated);
  border-color: rgba(59,130,246,.55);
  color: var(--af-text);
  box-shadow: 0 0 0 .2rem rgba(59,130,246,.15);
}
.table {
  --tblr-table-color: var(--af-text-body);
  color: var(--af-text-body);
}
.modal-content {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  color: var(--af-text-body);
}
.dropdown-menu {
  background: var(--af-surface) !important;
  border: 1px solid var(--af-border) !important;
}
.page-wrapper, .page-body { background: var(--af-bg); }
@media (max-width: 991.98px) {
  .dashboard-body-part {
    padding-bottom: calc(var(--af-bottom-nav-h, 64px) + 1.5rem + env(safe-area-inset-bottom, 0px));
  }
}
