:root {
  --bg: #000000;
  --sidebar: #0a0a0a;
  --panel: #0f0f10;
  --surface: #171719;
  --surface-hover: #1e1e21;
  --border: #232326;
  --border-light: #2a2a2e;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent: #00b4db;
  --accent-dark: #0093b5;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

#toast-container {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  border-left: 4px solid var(--green);
  min-width: 280px;
  max-width: 360px;
  animation: slideIn 0.28s ease;
  font-size: 14px;
  color: var(--text-primary);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.toast.error { border-left-color: var(--red); }
.toast strong { display: block; margin-bottom: 2px; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* TOPBAR */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px;
  height: 42px;
  background-position: center;
  flex-shrink: 0;
}
.brand h1 { font-size: 18px; margin: 0; line-height: 1.1; font-weight: 600; color: var(--text-primary); }
.brand p { margin: 0; font-size: 11px; color: var(--text-tertiary); margin-top: -2px; }

.top-nav { display: flex; align-items: center; gap: 2px; }
.tn-btn {
  background: transparent;
  border: 0;
  color: var(--text-tertiary);
  padding: 0 14px;
  height: 64px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
}
.tn-btn:hover { color: var(--text-primary); }
.tn-btn.active { color: var(--text-primary); border-bottom-color: var(--accent); }

/* MAIN CONTENT */
main { max-width: 1200px; margin: 26px auto; padding: 0 16px 24px; }
.tab-pane { display: none; animation: fade 0.25s ease; }
.tab-pane.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* CARDS */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.card h4 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); }
.muted { color: var(--text-secondary); font-size: 13px; }
.muted-small { color: var(--text-tertiary); font-size: 12px; }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
}
.badge.gray { background: rgba(255,255,255,0.05); color: var(--text-secondary); border-color: var(--border); }
.badge.green { background: rgba(34,197,94,0.1); color: #4ade80; border-color: rgba(34,197,94,0.2); }
.badge.orange { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.2); }

/* GRIDS */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.leilao-grid { display: grid; grid-template-columns: 320px 1fr 320px; gap: 20px; align-items: start; }
@media(max-width: 1024px) { .leilao-grid { grid-template-columns: 1fr 1.1fr; } }
@media(max-width: 880px) { .leilao-grid { grid-template-columns: 1fr; } }

/* FORMS */
label { display: block; font-size: 13px; color: var(--text-secondary); margin: 0 0 6px; font-weight: 600; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  transition: 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,180,219,0.1);
}
input:disabled, select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg);
}

/* FORM LAYOUT UTILS */
.form-row { display: flex; gap: 14px; width: 100%; margin-bottom: 14px; }
.col-10 { width: 10%; }
.col-15 { width: 15%; }
.col-20 { width: 20%; }
.col-25 { width: 25%; }
.col-30 { width: 30%; }
.col-35 { width: 35%; }
.col-40 { width: 40%; }
.col-50 { width: 50%; }
@media(max-width: 768px) {
  .form-row { flex-direction: column; gap: 10px; }
  .form-row > div { width: 100%; }
}
.section-header {
  width: 100%;
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}
.text-center { text-align: center; }
.icon-link {
  text-decoration: none;
  color: var(--text-tertiary);
  margin-left: 4px;
  font-size: 12px;
}
.icon-link:hover { color: var(--accent); }

.section-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px 16px;
  margin-bottom: 24px;
}
.section-block .section-header {
  border-bottom: 1px solid var(--border-light);
  margin-top: 16px;
  margin-bottom: 16px;
  padding-bottom: 8px;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  box-shadow: 0 10px 15px rgba(0,0,0,0.5);
}
.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item:hover {
  background: var(--surface-hover);
}
.autocomplete-item strong {
  display: block;
  color: var(--text-primary);
}
.autocomplete-item small {
  color: var(--text-secondary);
}

/* BUTTONS */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-light); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-green {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  width: 100%;
}
.btn-green:hover { background: #16a34a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* UTILS */
.text-center-empty { padding: 30px; text-align: center; color: var(--text-tertiary); font-size: 14px; }
.card-header-flex { display: flex; justify-content: space-between; align-items: start; }
.card-header-flex-center { display: flex; justify-content: space-between; align-items: center; }
.mt-14-flex { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.mt-16-flex-center { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.flex-center-wrap { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.text-left { text-align: left; }
.max-w-160 { max-width: 160px; }
.m-0 { margin: 0; }
.mt-4 { margin-top: 4px; }
.mb-10 { margin-bottom: 10px; }
.card-title-margin { margin: 8px 0 4px; }
.card-subtitle-nomargin { margin: 0; }
.mt-minus-4-mb-16 { margin-top: -4px; margin-bottom: 16px; }
.mt-minus-6 { margin-top: -6px; }

/* SPECIFIC SECTIONS */
.tip { border-left: 4px solid var(--accent); background: rgba(0,180,219,0.05); }
.dica-title { margin: 0 0 6px; color: var(--accent); }
.dica-text { margin: 0; font-size: 14px; color: var(--text-secondary); }

.info-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; font-size: 13px; }
.info-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.info-list li:last-child { border: 0; }
.info-list strong { color: var(--text-primary); }

.center-box { text-align: center; padding: 26px 20px; }
.timer {
  font-size: 68px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 6px 0 4px;
}
.timer-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.price {
  font-size: 42px;
  font-weight: 700;
  color: var(--green);
  margin: 8px 0 4px;
  letter-spacing: 0.5px;
}
.economy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34,197,94,0.1);
  color: #4ade80;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  margin: 6px 0 16px;
}

.lance-row { display: flex; gap: 8px; margin-top: 12px; }
.lance-row input { font-size: 18px; font-weight: 600; text-align: center; }

.ranking { margin-top: 18px; text-align: left; }
.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.rank-item.me { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); font-weight: 600; color: #4ade80; }
.rank-pos {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
}
.rank-left { display: flex; align-items: center; }

.feed { max-height: 380px; overflow: auto; padding-right: 6px; }
.feed-item {
  font-size: 12px;
  padding: 9px 10px;
  border-left: 3px solid var(--border);
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-secondary);
}
.feed-item.win { border-left-color: var(--green); background: rgba(34,197,94,0.1); color: #4ade80; }
.feed-item.you { border-left-color: var(--accent); background: rgba(0,180,219,0.1); color: var(--accent); }

.profile { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--border), var(--border-light));
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.seloss { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.selo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.selo.ok { background: rgba(34,197,94,0.1); color: #4ade80; }

.card-saldo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.saldo-label { font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; color: var(--text-tertiary); }
.saldo-valor { font-size: 28px; font-weight: 700; color: var(--green); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); text-align: center; }
.metric .v { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.metric .k { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }

.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--surface); border-radius: 8px; font-size: 13px; border: 1px solid var(--border); }
.doc-list li strong { color: var(--text-primary); }

.chart-wrap { padding: 10px; }
canvas { width: 100%; height: 260px; display: block; }

.map-wrap { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.map-wrap svg { max-width: 420px; width: 100%; height: auto; }

.overflow-auto { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.table td { background: var(--panel); padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-hover); }
.table tr:last-child td { border-bottom: 0; }

footer {
  margin-top: 0;
  padding: 20px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
footer strong { color: var(--text-primary); }
.footer-text { margin: 6px 0 0; font-size: 12px; color: var(--text-tertiary); }

@media(max-width: 720px) {
  .topbar { padding: 0 16px; }
  .timer { font-size: 52px; }
  .price { font-size: 34px; }
}

/* LIGHT THEME */
body.light {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
}
body.light .topbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
}
body.light .badge.gray { background: #f1f5f9; color: #334155; }
body.light .card { border-color: var(--border-light); }
body.light .btn-primary { color: #fff; }

/* ============================================ */
/* TRANSPORTADORAS - REDESIGN                   */
/* ============================================ */

/* Page Header */
.carrier-page-header {
  margin-bottom: 4px;
}
.carrier-page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  margin: 0;
  text-transform: uppercase;
}

/* Action Bar */
.carrier-action-bar {
  margin-bottom: 24px;
}
.carrier-action-bar .btn-primary {
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px;
}

/* Filters Card */
.carrier-filters-card {
  margin-bottom: 24px;
  padding: 20px 24px 24px;
}
.carrier-filters-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.carrier-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.carrier-filter-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.carrier-filter-item input,
.carrier-filter-item select {
  font-size: 13px;
  padding: 8px 10px;
}

@media(max-width: 900px) {
  .carrier-filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media(max-width: 520px) {
  .carrier-filters-grid {
    grid-template-columns: 1fr;
  }
}

/* Table Card */
.carrier-table-card {
  padding: 0;
  overflow: hidden;
}
.carrier-table-card .overflow-auto {
  margin: 0;
}

/* Carrier Table */
.carrier-table {
  table-layout: fixed;
  width: 100%;
}
.carrier-table th {
  white-space: nowrap;
  padding: 14px 16px;
  font-size: 11px;
}
.carrier-table td {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.carrier-table th:nth-child(6),
.carrier-table td:nth-child(6) {
  text-align: center;
}
.carrier-table th:nth-child(7),
.carrier-table td:nth-child(7) {
  text-align: center;
}
.carrier-table th:first-child,
.carrier-table td:first-child {
  padding-left: 20px;
}
.carrier-table th:last-child,
.carrier-table td:last-child {
  padding-right: 20px;
}

/* Ghost button small */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

/* User Table */
.user-table {
  table-layout: fixed;
  width: 100%;
}
.user-table th {
  white-space: nowrap;
  padding: 14px 16px;
  font-size: 11px;
}
.user-table td {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-table th:last-child,
.user-table td:last-child {
  text-align: center;
}
.user-table th:first-child,
.user-table td:first-child {
  padding-left: 20px;
}
.user-table th:last-child,
.user-table td:last-child {
  padding-right: 20px;
}

/* Col-100 utility */
.col-100 { width: 100%; }

/* ============================================ */
/* USER MENU                                    */
/* ============================================ */
.user-menu-wrap { position: relative; display: inline-block; }

.user-menu-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  cursor: pointer; font-family: inherit; font-size: 13px;
  color: var(--text-primary); transition: all .15s;
  height: 40px;
}
.user-menu-trigger:hover { background: var(--surface-hover); border-color: var(--border-light); }

.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-avatar-lg {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-menu-name { font-weight: 600; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.user-menu-arrow { font-size: 10px; color: var(--text-tertiary); }

.user-menu-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; min-width: 240px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  padding: 6px 0;
  animation: umenu-in .15s ease;
}
.user-menu-dropdown.open { display: block; }
@keyframes umenu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.user-menu-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 10px;
}
.user-menu-fullname { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.user-menu-role { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .3px; }

.user-menu-sep { height: 1px; background: var(--border); margin: 4px 12px; }

.user-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-primary); background: none; border: none;
  cursor: pointer; font-family: inherit; transition: .12s;
  text-decoration: none;
}
.user-menu-item:hover { background: var(--surface-hover); }
.user-menu-item-indent { padding-left: 28px; }
.user-menu-item-danger { color: var(--red, #ef4444); }
.user-menu-item-danger:hover { background: rgba(239,68,68,.08); }

.user-menu-group-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: default;
}

/* Badge blue */
.badge.blue { background: rgba(59,130,246,.1); color: #60a5fa; border-color: rgba(59,130,246,.2); }
body.light .badge.blue { background: #eff6ff; color: #1d4ed8; }

/* Auth section labels */
.auth-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--accent, #3b82f6);
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
  margin: 12px 0 12px;
}

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  animation: fade .15s ease;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; max-width: 420px; width: 90%;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
body.light .modal-box { background: #fff; }

/* Light theme fixes for user menu */
body.light .user-menu-dropdown { background: #fff; border-color: #e2e8f0; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
body.light .user-menu-item:hover { background: #f1f5f9; }
body.light .user-menu-trigger { background: #f8fafc; border-color: #e2e8f0; }
body.light .user-menu-trigger:hover { background: #f1f5f9; }
