/* ═══════════════════════════════════════════════════════
   Via Fácil Frete — Design System
   Baseado no design Lovable (paleta laranja/creme, oklch)
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ── Tokens de cor (oklch) ─────────────────────────────── */
:root {
  --radius: 1rem;
  --background:   oklch(0.985 0.012 80);
  --foreground:   oklch(0.22 0.04 50);
  --card:         oklch(1 0 0);
  --card-fg:      oklch(0.22 0.04 50);
  --primary:      oklch(0.7 0.18 45);
  --primary-fg:   oklch(0.99 0 0);
  --primary-soft: oklch(0.96 0.04 60);
  --secondary:    oklch(0.96 0.02 70);
  --secondary-fg: oklch(0.28 0.05 50);
  --muted:        oklch(0.96 0.012 80);
  --muted-fg:     oklch(0.5 0.03 60);
  --accent:       oklch(0.95 0.05 60);
  --accent-fg:    oklch(0.3 0.08 45);
  --destructive:  oklch(0.62 0.22 25);
  --destructive-fg: oklch(0.99 0 0);
  --success:      oklch(0.65 0.16 155);
  --success-fg:   oklch(0.99 0 0);
  --warning:      oklch(0.78 0.16 80);
  --warning-fg:   oklch(0.25 0.06 60);
  --info:         oklch(0.65 0.14 240);
  --info-fg:      oklch(0.99 0 0);
  --border:       oklch(0.92 0.015 70);
  --input-bg:     oklch(0.94 0.012 70);
  --ring:         oklch(0.7 0.18 45);
  --sidebar-bg:   oklch(1 0 0);
  --sidebar-fg:   oklch(0.3 0.04 50);
  --sidebar-accent:    oklch(0.96 0.04 60);
  --sidebar-accent-fg: oklch(0.5 0.18 45);
  --sidebar-border:    oklch(0.94 0.015 70);
  --gradient-primary: linear-gradient(135deg, oklch(0.72 0.19 50), oklch(0.65 0.21 30));
  --gradient-warm:    linear-gradient(135deg, oklch(0.75 0.17 60), oklch(0.68 0.2 35));
  --shadow-soft: 0 1px 2px oklch(0.5 0.05 50 / 0.04), 0 8px 24px oklch(0.5 0.05 50 / 0.06);
  --shadow-card: 0 1px 0 oklch(0.5 0.05 50 / 0.03), 0 12px 32px -8px oklch(0.5 0.1 45 / 0.1);
  --shadow-glow: 0 12px 40px -8px oklch(0.7 0.2 45 / 0.4);
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

/* ── Reset base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-sans); font-size: 14px;
  background: var(--background); color: var(--foreground);
  -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); letter-spacing: -0.02em; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Layout shell ──────────────────────────────────────── */
.vf-shell { display: flex; min-height: 100vh; background: var(--background); }

/* ── Sidebar ───────────────────────────────────────────── */
.vf-sidebar {
  width: 240px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform .25s ease;
}
.vf-sidebar-logo { padding: 1.25rem 1rem 1rem; }
.vf-logo-link { display: flex; align-items: center; gap: .75rem; }
.vf-logo-icon {
  width: 40px; height: 40px; border-radius: .75rem;
  background: var(--gradient-primary); display: flex; align-items: center;
  justify-content: center; box-shadow: var(--shadow-glow); flex-shrink: 0;
  color: white;
}
.vf-logo-icon svg { width: 20px; height: 20px; }
.vf-logo-name { display: block; font-family: var(--font-display); font-weight: 800;
  font-size: .9rem; color: var(--foreground); line-height: 1.1; }
.vf-logo-name span { color: var(--primary); }
.vf-logo-sub { display: block; font-size: .7rem; color: var(--muted-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.vf-nav { flex: 1; padding: 0 .75rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.vf-nav-label { font-size: .65rem; font-weight: 600; letter-spacing: .14em;
  color: var(--muted-fg); text-transform: uppercase; padding: 0 .75rem; margin-bottom: .35rem; }
.vf-nav-items { display: flex; flex-direction: column; gap: .15rem; }
.vf-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; border-radius: .75rem; font-size: .85rem;
  font-weight: 500; color: var(--sidebar-fg);
  transition: background .15s, color .15s;
}
.vf-nav-item:hover { background: var(--secondary); }
.vf-nav-item.active {
  background: var(--sidebar-accent); color: var(--sidebar-accent-fg);
  box-shadow: var(--shadow-soft); font-weight: 600;
}
.vf-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.vf-sidebar-footer { padding: .75rem; border-top: 1px solid var(--sidebar-border); }

/* Mobile sidebar overlay */
.vf-sidebar-overlay {
  display: none; position: fixed; inset: 0; background: oklch(0 0 0 / .4);
  z-index: 49; backdrop-filter: blur(2px);
}
@media (max-width: 991px) {
  .vf-sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); }
  .vf-sidebar.open { transform: translateX(0); }
  .vf-sidebar-overlay.open { display: block; }
  .vf-main { margin-left: 0 !important; }
}

/* ── Main area ─────────────────────────────────────────── */
.vf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Topbar ─────────────────────────────────────────────── */
.vf-topbar {
  position: sticky; top: 0; z-index: 20; height: 64px;
  border-bottom: 1px solid var(--border);
  background: oklch(0.985 0.012 80 / .85); backdrop-filter: blur(16px);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem 0 1rem;
}
.vf-topbar-hamburger {
  display: none; width: 36px; height: 36px; border-radius: .5rem;
  align-items: center; justify-content: center; color: var(--foreground);
  background: var(--secondary);
}
@media (max-width: 991px) { .vf-topbar-hamburger { display: flex; } }
.vf-topbar-title { font-family: var(--font-display); font-weight: 700;
  font-size: 1.05rem; color: var(--foreground); white-space: nowrap; }
.vf-topbar-search {
  flex: 1; max-width: 400px; margin-left: 1.5rem; position: relative;
  display: none;
}
@media (min-width: 768px) { .vf-topbar-search { display: block; } }
.vf-topbar-search svg { position: absolute; left: .875rem; top: 50%;
  transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-fg); }
.vf-topbar-search input {
  width: 100%; height: 38px; padding: 0 1rem 0 2.5rem;
  border-radius: 999px; background: var(--secondary); border: none;
  font-size: .82rem; color: var(--foreground); outline: none;
}
.vf-topbar-search input:focus { box-shadow: 0 0 0 2px oklch(0.7 0.18 45 / .3); }
.vf-topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.vf-plan-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .75rem; border-radius: 999px;
  background: oklch(0.65 0.16 155 / .12); color: var(--success);
  font-size: .72rem; font-weight: 600;
}
.vf-plan-badge svg { width: 13px; height: 13px; }
.vf-bell-btn {
  width: 36px; height: 36px; border-radius: 999px; background: var(--secondary);
  display: flex; align-items: center; justify-content: center; color: var(--foreground);
  cursor: pointer; transition: background .15s;
}
.vf-bell-btn:hover { background: var(--accent); }
.vf-bell-btn svg { width: 17px; height: 17px; }
.vf-user-avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--gradient-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .82rem; box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.vf-user-info { line-height: 1.25; }
.vf-user-name { font-size: .82rem; font-weight: 600; }
.vf-user-email { font-size: .68rem; color: var(--muted-fg); }
@media (max-width: 576px) { .vf-user-info { display: none; } }

/* ── Page content ───────────────────────────────────────── */
.vf-content { flex: 1; padding: 2rem 2.5rem; width: 100%; max-width: 1500px; margin: 0 auto; }
@media (max-width: 768px) { .vf-content { padding: 1.25rem 1rem; } }

/* ── Cards ──────────────────────────────────────────────── */
.vf-card {
  background: var(--card); border-radius: 1.25rem;
  box-shadow: var(--shadow-card); border: 1px solid oklch(0.92 0.015 70 / .6);
  overflow: hidden;
}
.vf-card-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid oklch(0.92 0.015 70 / .6);
}
.vf-card-header-icon {
  width: 32px; height: 32px; border-radius: .5rem;
  background: oklch(0.7 0.18 45 / .1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.vf-card-header-icon svg { width: 15px; height: 15px; }
.vf-card-title { font-family: var(--font-display); font-weight: 700;
  font-size: .95rem; color: var(--foreground); }
.vf-card-action { margin-left: auto; }
.vf-card-body { padding: 1.25rem; }

/* ── Stat cards ─────────────────────────────────────────── */
.vf-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (min-width: 992px) { .vf-stat-grid { grid-template-columns: repeat(4, 1fr); } }
.vf-stat {
  background: var(--card); border-radius: 1.25rem;
  box-shadow: var(--shadow-card); border: 1px solid oklch(0.92 0.015 70 / .6);
  padding: 1.1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  transition: transform .15s;
}
.vf-stat:hover { transform: translateY(-2px); }
.vf-stat-icon {
  width: 48px; height: 48px; border-radius: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.vf-stat-icon svg { width: 22px; height: 22px; }
.vf-stat-icon.info    { background: oklch(0.65 0.14 240 / .1); color: var(--info); }
.vf-stat-icon.success { background: oklch(0.65 0.16 155 / .1); color: var(--success); }
.vf-stat-icon.warning { background: oklch(0.78 0.16 80 / .15); color: var(--warning-fg); }
.vf-stat-icon.danger  { background: oklch(0.62 0.22 25 / .1); color: var(--destructive); }
.vf-stat-icon.primary { background: oklch(0.7 0.18 45 / .1); color: var(--primary); }
.vf-stat-value { font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--foreground); white-space: nowrap; }
.vf-stat-label { font-size: .72rem; color: var(--muted-fg); margin-top: .15rem; }

/* ── Badges ─────────────────────────────────────────────── */
.vf-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.vf-badge svg { width: 11px; height: 11px; }
.vf-badge.muted   { background: var(--secondary); color: var(--secondary-fg); }
.vf-badge.primary { background: oklch(0.7 0.18 45 / .12); color: var(--primary); }
.vf-badge.success { background: oklch(0.65 0.16 155 / .12); color: var(--success); }
.vf-badge.warning { background: oklch(0.78 0.16 80 / .2); color: var(--warning-fg); }
.vf-badge.info    { background: oklch(0.65 0.14 240 / .1); color: var(--info); }
.vf-badge.danger  { background: oklch(0.62 0.22 25 / .1); color: var(--destructive); }

/* ── Buttons ────────────────────────────────────────────── */
.vf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 40px; padding: 0 1.1rem; border-radius: .75rem;
  font-size: .82rem; font-weight: 600; transition: all .15s; white-space: nowrap;
  cursor: pointer; border: none; font-family: inherit;
}
.vf-btn svg { width: 15px; height: 15px; }
.vf-btn.primary { background: var(--gradient-primary); color: white;
  box-shadow: var(--shadow-glow); }
.vf-btn.primary:hover { opacity: .92; }
.vf-btn.secondary { background: var(--secondary); color: var(--foreground); }
.vf-btn.secondary:hover { background: var(--accent); }
.vf-btn.success { background: var(--success); color: white; }
.vf-btn.success:hover { opacity: .9; }
.vf-btn.outline { background: var(--card); color: var(--foreground);
  border: 1px solid var(--border); }
.vf-btn.outline:hover { background: var(--secondary); }
.vf-btn.ghost { background: transparent; color: var(--foreground); }
.vf-btn.ghost:hover { background: var(--secondary); }
.vf-btn.danger { background: var(--destructive); color: white; }
.vf-btn.sm { height: 34px; padding: 0 .85rem; font-size: .78rem; border-radius: .6rem; }
.vf-btn.lg { height: 48px; padding: 0 1.5rem; font-size: .9rem; }
.vf-btn.full { width: 100%; }
.vf-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form fields ────────────────────────────────────────── */
.vf-field { display: flex; flex-direction: column; }
.vf-label {
  font-size: .65rem; font-weight: 600; letter-spacing: .14em;
  color: var(--muted-fg); text-transform: uppercase; margin-bottom: .45rem;
  display: flex; align-items: center; gap: .35rem;
}
.vf-label svg { width: 13px; height: 13px; }
.vf-input, .vf-select, .vf-textarea {
  width: 100%; height: 42px; padding: 0 .875rem; border-radius: .75rem;
  background: var(--input-bg); border: 1px solid var(--border);
  font-size: .85rem; color: var(--foreground); outline: none;
  transition: box-shadow .15s, border-color .15s; font-family: inherit;
}
.vf-input:focus, .vf-select:focus, .vf-textarea:focus {
  box-shadow: 0 0 0 2px oklch(0.7 0.18 45 / .3); border-color: var(--ring);
}
.vf-textarea { height: auto; padding: .6rem .875rem; resize: vertical; }
.vf-input-group { display: flex; }
.vf-input-group .vf-input-prefix {
  display: flex; align-items: center; padding: 0 .75rem;
  background: var(--secondary); border: 1px solid var(--border);
  border-right: none; border-radius: .75rem 0 0 .75rem;
  font-size: .82rem; font-weight: 600; color: var(--primary); white-space: nowrap;
}
.vf-input-group .vf-input { border-radius: 0 .75rem .75rem 0; }

/* ── Grid helpers ───────────────────────────────────────── */
.vf-grid { display: grid; gap: 1rem; }
.vf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.vf-grid-3 { grid-template-columns: repeat(3, 1fr); }
.vf-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .vf-grid-2, .vf-grid-3, .vf-grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .vf-grid-3, .vf-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Table ──────────────────────────────────────────────── */
.vf-table-wrap { overflow-x: auto; }
.vf-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.vf-table thead tr {
  background: oklch(0.96 0.02 70 / .5);
  font-size: .65rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-fg);
}
.vf-table th { font-weight: 600; padding: .6rem 1rem; text-align: left; white-space: nowrap; }
.vf-table td { padding: .75rem 1rem; border-top: 1px solid oklch(0.92 0.015 70 / .6); }
.vf-table tbody tr:hover { background: oklch(0.96 0.02 70 / .35); }
.vf-table .text-right { text-align: right; }
.vf-table .font-mono { font-family: ui-monospace, monospace; }
.vf-placa-tag {
  display: inline-flex; align-items: center; padding: .15rem .5rem;
  background: var(--secondary); border-radius: .4rem;
  font-family: ui-monospace, monospace; font-size: .72rem; font-weight: 600;
}

/* ── Avatar ─────────────────────────────────────────────── */
.vf-avatar {
  border-radius: 999px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 600; color: white;
  flex-shrink: 0; font-size: .75rem;
}

/* ── Alert boxes (flash) ────────────────────────────────── */
.vf-alert {
  padding: .85rem 1rem; border-radius: .875rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: .6rem; font-size: .85rem;
}
.vf-alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.vf-alert.success { background: oklch(0.65 0.16 155 / .1);
  color: var(--success); border: 1px solid oklch(0.65 0.16 155 / .25); }
.vf-alert.danger  { background: oklch(0.62 0.22 25 / .1);
  color: var(--destructive); border: 1px solid oklch(0.62 0.22 25 / .25); }
.vf-alert.warning { background: oklch(0.78 0.16 80 / .12);
  color: var(--warning-fg); border: 1px solid oklch(0.78 0.16 80 / .3); }
.vf-alert.info    { background: oklch(0.65 0.14 240 / .1);
  color: var(--info); border: 1px solid oklch(0.65 0.14 240 / .25); }

/* ── Section divider ────────────────────────────────────── */
.vf-section-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .12em;
  color: var(--muted-fg); text-transform: uppercase;
  padding-bottom: .5rem; border-bottom: 1px solid var(--border);
  margin: 1.5rem 0 .875rem; display: flex; align-items: center; gap: .4rem;
}
.vf-section-label svg { width: 13px; height: 13px; }

/* ── Misc ───────────────────────────────────────────────── */
.vf-text-success { color: var(--success); }
.vf-text-danger  { color: var(--destructive); }
.vf-text-muted   { color: var(--muted-fg); font-size: .78rem; }
.vf-fw-bold { font-weight: 700; font-family: var(--font-display); }
.vf-flex { display: flex; align-items: center; }
.vf-gap-2 { gap: .5rem; }
.vf-gap-3 { gap: .75rem; }
.vf-ml-auto { margin-left: auto; }
.vf-mb-6 { margin-bottom: 1.5rem; }
.vf-mt-4 { margin-top: 1rem; }

/* ── Button variant aliases (hyphen form) ───────────────── */
.vf-btn-primary   { background: var(--gradient-primary); color: white; box-shadow: var(--shadow-glow); border: none; }
.vf-btn-primary:hover { opacity: .92; }
.vf-btn-secondary { background: var(--secondary); color: var(--foreground); border: none; }
.vf-btn-secondary:hover { background: var(--accent); }
.vf-btn-success   { background: var(--success); color: white; border: none; }
.vf-btn-success:hover { opacity: .9; }

/* ── Responsividade mobile global ───────────────────────── */
@media (max-width: 640px) {
  /* Colapsa todos os grids inline de múltiplas colunas para 1 coluna */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:360px 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 90px 130px 100px auto"],
  [style*="grid-template-columns:1fr 1fr 150px auto"],
  [style*="grid-template-columns:1fr 1fr;gap:12px"],
  [style*="grid-template-columns:1fr 110px"] {
    grid-template-columns: 1fr !important;
  }

  /* Formulários de nova entrada em linha — empilhar */
  .vf-content form [style*="display:grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Cards lado a lado no admin — colapsar */
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:360px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
.vf-btn-warning   { background: var(--warning); color: white; border: none; }
.vf-btn-warning:hover { opacity: .9; }
.vf-btn-danger    { background: var(--destructive); color: white; border: none; }
.vf-btn-danger:hover  { opacity: .9; }
.vf-btn-outline   { background: var(--card); color: var(--foreground); border: 1px solid var(--border); }
.vf-btn-outline:hover { background: var(--secondary); }
.vf-btn-ghost     { background: transparent; color: var(--foreground); border: none; }
.vf-btn-ghost:hover { background: var(--secondary); }
.vf-btn-sm  { height: 34px; padding: 0 .85rem; font-size: .78rem; border-radius: .6rem; }
.vf-btn-lg  { height: 48px; padding: 0 1.5rem; font-size: .9rem; }
.vf-btn-full { width: 100%; justify-content: center; }

/* ── Input addon (prefix like "R$") ────────────────────── */
.vf-input-group { display: flex; position: relative; }
.vf-input-addon {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.vf-input-group .vf-input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.vf-input-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex; align-items: center;
}
