:root {
  --navy: #0A1628;
  --navy-light: #0D2137;
  --blue: #1A3A5C;
  --orange: #FF6B00;
  --orange-light: #FF8C35;
  --orange-pale: #FFF3E8;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-600: #475569;
  --gray-800: #1E293B;
  --green: #16A34A;
  --green-pale: #DCFCE7;
  --red: #DC2626;
  --red-pale: #FEE2E2;
  --yellow: #D97706;
  --yellow-pale: #FEF3C7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ── Navbar ── */
.navbar {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--white);
}
.logo-icon { color: var(--orange); font-size: 1.6rem; }
.logo-accent { color: var(--orange); }
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-link {
  color: rgba(255,255,255,.8);
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .6rem;
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
  position: relative;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.08); }
.nav-chat { display: flex; align-items: center; gap: .3rem; }
.badge-chat {
  background: var(--orange);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.nav-user {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--orange);
}
.nav-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: .5rem 0;
  border: 1px solid var(--gray-200);
}
.nav-user:hover .nav-dropdown { display: block; }
.nav-username {
  display: block;
  padding: .5rem 1rem .1rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
}
.nav-tipo {
  display: block;
  padding: 0 1rem .5rem;
  font-size: .75rem;
  color: var(--gray-400);
}
.dropdown-divider { height: 1px; background: var(--gray-200); margin: .25rem 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  color: var(--gray-600);
  transition: background .15s;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--gray-800); }
.dropdown-item.text-danger { color: var(--red); }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
}
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--blue); }
.btn-outline { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: #fff; }
.btn-outline-dark { background: transparent; color: var(--gray-800); border: 1.5px solid var(--gray-200); }
.btn-outline-dark:hover { background: var(--gray-100); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.1); }
.btn-red { background: var(--red); color: #fff; }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.8rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Flash ── */
.flash-container {
  position: fixed;
  top: 70px;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
}
.flash {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .3s ease;
}
.flash button { margin-left: auto; background: none; border: none; font-size: 1.1rem; cursor: pointer; opacity: .7; }
.flash-success { background: var(--green-pale); color: var(--green); border-left: 3px solid var(--green); }
.flash-danger { background: var(--red-pale); color: var(--red); border-left: 3px solid var(--red); }
.flash-warning { background: var(--yellow-pale); color: var(--yellow); border-left: 3px solid var(--yellow); }
.flash-info { background: #EFF6FF; color: #1D4ED8; border-left: 3px solid #1D4ED8; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }

/* ── Layout ── */
.main-content { flex: 1; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.page-header {
  background: var(--navy);
  color: #fff;
  padding: 2rem 0;
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: rgba(255,255,255,.7); margin-top: .3rem; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Frete Card ── */
.frete-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 1.25rem 1.5rem;
  transition: box-shadow .2s, transform .2s;
}
.frete-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.frete-rota {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .75rem;
}
.frete-rota .arrow { color: var(--orange); font-size: .9rem; }
.frete-uf {
  background: var(--navy);
  color: #fff;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
}
.frete-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  font-size: .82rem;
  color: var(--gray-600);
  margin-bottom: .75rem;
}
.frete-meta span { display: flex; align-items: center; gap: .3rem; }
.frete-meta i { color: var(--orange); }
.frete-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .75rem;
  border-top: 1px solid var(--gray-100);
}
.frete-valor {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
}

/* ── Badges / Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-orange { background: var(--orange-pale); color: var(--orange); }
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-red { background: var(--red-pale); color: var(--red); }
.badge-navy { background: #E8EDF5; color: var(--navy); }
.badge-verificado { background: var(--green-pale); color: var(--green); font-size: .75rem; }

.status-aberto { background: var(--orange-pale); color: var(--orange); }
.status-em_negociacao { background: #EFF6FF; color: #1D4ED8; }
.status-em_transito { background: var(--yellow-pale); color: var(--yellow); }
.status-entregue { background: var(--green-pale); color: var(--green); }
.status-cancelado { background: var(--red-pale); color: var(--red); }
.status-fechado { background: var(--gray-100); color: var(--gray-600); }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .5rem;
}
.stat-icon.orange { background: var(--orange-pale); color: var(--orange); }
.stat-icon.green { background: var(--green-pale); color: var(--green); }
.stat-icon.navy { background: #E8EDF5; color: var(--navy); }
.stat-icon.blue { background: #EFF6FF; color: #1D4ED8; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); }
.stat-label { font-size: .8rem; color: var(--gray-600); font-weight: 500; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--gray-800); margin-bottom: .4rem; }
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,107,0,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }

/* ── Auth pages ── */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
}
.auth-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo .logo-text { font-size: 2rem; font-weight: 800; color: var(--navy); }
.auth-title { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
.auth-subtitle { color: var(--gray-600); font-size: .875rem; margin-bottom: 1.5rem; }
.tipo-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.tipo-btn {
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  background: var(--white);
}
.tipo-btn i { font-size: 1.5rem; display: block; margin-bottom: .4rem; color: var(--gray-400); }
.tipo-btn span { font-size: .875rem; font-weight: 600; color: var(--gray-600); }
.tipo-btn.active { border-color: var(--orange); background: var(--orange-pale); }
.tipo-btn.active i, .tipo-btn.active span { color: var(--orange); }
.auth-divider { text-align: center; color: var(--gray-400); font-size: .8rem; margin: 1rem 0; position: relative; }
.auth-divider::before, .auth-divider::after { content:''; position:absolute; top:50%; width:42%; height:1px; background:var(--gray-200); }
.auth-divider::before { left:0; }
.auth-divider::after { right:0; }

/* ── Hero (landing) ── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 60%, #1e4976 100%);
  color: #fff;
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(255,107,0,.06);
  pointer-events: none;
}
.hero-content { max-width: 640px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero h1 span { color: var(--orange); }
.hero p { font-size: 1.1rem; color: rgba(255,255,255,.8); margin-bottom: 2rem; max-width: 520px; }
.hero-btns { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.hero-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--orange); }
.hero-stat-label { font-size: .8rem; color: rgba(255,255,255,.65); }

/* ── Features ── */
.features { padding: 4rem 0; background: var(--white); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.feature-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  transition: box-shadow .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--orange-pale);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: .4rem; }
.feature-card p { font-size: .875rem; color: var(--gray-600); }

/* ── Section ── */
.section { padding: 3rem 0; }
.section-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: .3rem; }
.section-subtitle { color: var(--gray-600); font-size: .9rem; margin-bottom: 2rem; }

/* ── Fretes grid ── */
.fretes-grid { display: grid; gap: 1rem; }
.fretes-filters {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.fretes-filters .form-group { margin: 0; flex: 1; min-width: 150px; }

/* ── Chat ── */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 64px); }
.chat-sidebar {
  border-right: 1px solid var(--gray-200);
  background: var(--white);
  overflow-y: auto;
}
.chat-sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  position: sticky;
  top: 0;
  background: var(--white);
}
.chat-item {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .15s;
  display: flex;
  gap: .75rem;
  align-items: center;
}
.chat-item:hover, .chat-item.active { background: var(--gray-50); }
.chat-item-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; font-size: .875rem; color: var(--gray-800); }
.chat-item-last { font-size: .78rem; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-badge { background: var(--orange); color: #fff; border-radius: 999px; padding: .1rem .45rem; font-size: .7rem; font-weight: 700; }
.chat-main { display: flex; flex-direction: column; }
.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  background: var(--gray-50);
}
.msg { display: flex; gap: .5rem; max-width: 70%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.msg-bubble {
  background: var(--white);
  border-radius: 12px;
  padding: .6rem .9rem;
  font-size: .875rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.msg.mine .msg-bubble { background: var(--navy); color: #fff; border-color: var(--navy); }
.msg-time { font-size: .7rem; color: var(--gray-400); margin-top: .25rem; }
.msg.mine .msg-time { text-align: right; color: rgba(255,255,255,.6); }
.chat-input-bar {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  gap: .75rem;
  align-items: center;
}
.chat-input {
  flex: 1;
  padding: .65rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  font-size: .875rem;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--orange); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--orange); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  transition: background .2s;
}
.chat-send-btn:hover { background: var(--orange-light); }
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  gap: .75rem;
  font-size: .9rem;
}
.chat-empty i { font-size: 3rem; color: var(--gray-200); }

/* ── Dashboard ── */
.dashboard-layout {
  padding: 2rem 0;
}
.dashboard-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; margin-top: 1.5rem; }

/* ── Perfil ── */
.perfil-hero {
  background: var(--navy);
  color: #fff;
  padding: 2.5rem 0;
}
.perfil-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  border: 4px solid var(--orange);
  object-fit: cover;
  background: var(--blue);
}
.perfil-header { display: flex; align-items: center; gap: 1.5rem; }
.perfil-info h2 { font-size: 1.5rem; font-weight: 700; }
.perfil-info p { color: rgba(255,255,255,.7); margin-top: .25rem; }
.stars { color: var(--orange); font-size: .9rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { background: var(--gray-50); padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-100); }
tr:hover td { background: var(--gray-50); }

/* ── Footer ── */
.footer { background: var(--navy); color: rgba(255,255,255,.8); padding: 3rem 0 0; margin-top: auto; }
.footer-container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem 2rem; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-brand p { font-size: .85rem; color: rgba(255,255,255,.5); margin-top: .75rem; }
.footer-links h4 { font-size: .9rem; font-weight: 700; color: #fff; margin-bottom: .75rem; }
.footer-links a { display: block; font-size: .85rem; color: rgba(255,255,255,.6); margin-bottom: .4rem; transition: color .2s; }
.footer-links a:hover { color: var(--orange); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 1rem 1.5rem; text-align: center; font-size: .8rem; color: rgba(255,255,255,.4); }

/* ── Util ── */
.text-center { text-align: center; }
.text-orange { color: var(--orange); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gray { color: var(--gray-600); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--gray-400); }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .75rem; color: var(--gray-200); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-menu { display: none; }
  .nav-menu.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--navy); padding: 1rem; z-index: 999; }
  .nav-toggle { display: block; }
  .form-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .footer-container { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2.5rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .tipo-selector { grid-template-columns: 1fr 1fr; }
}
