/* ===== MODO Nexo — Global Styles ===== */
:root {
  --navy: #1F3864;
  --navy-dark: #162a4e;
  --navy-light: #2a4a82;
  --gold: #C49A2A;
  --gold-light: #d4aa3a;
  --white: #ffffff;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e0e4ec;
  --text: #222831;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #2563eb;
  --sidebar-w: 240px;
  --header-h: 60px;
  --bottom-nav-h: 64px;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

img { max-width: 100%; }

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo .brand {
  font-size: 22px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 2px;
}

.sidebar-logo .sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 14px;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border-left-color: var(--gold);
}

.nav-item .icon { font-size: 18px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: bold; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); }

.btn-logout {
  background: none; border: none; color: rgba(255,255,255,0.45);
  cursor: pointer; font-size: 18px; padding: 4px; border-radius: 6px;
  transition: color 0.2s;
}
.btn-logout:hover { color: var(--danger); }

/* Main content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--white);
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--navy);
}

.page-body {
  padding: 24px 28px;
  flex: 1;
}

/* ===== CARDS / SURFACES ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: bold;
  color: var(--navy);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: Arial, sans-serif;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: var(--navy-dark); color: var(--white); }

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-light); color: var(--white); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--navy);
  color: var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #b91c1c; color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: var(--navy);
  margin-bottom: 6px;
}

.required::after { content: ' *'; color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(31,56,100,0.1);
}

textarea { resize: vertical; min-height: 90px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* File upload */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--navy);
  background: rgba(31,56,100,0.04);
}
.upload-zone .icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone p { font-size: 14px; color: var(--text-muted); }
.upload-zone strong { color: var(--navy); }
input[type="file"] { display: none; }

.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: 8px; padding: 8px 12px;
  font-size: 13px;
}
.file-item .file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-size { color: var(--text-muted); white-space: nowrap; }
.file-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 2px; }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.badge-recebido    { background: #e5e7eb; color: #374151; }
.badge-analise     { background: #dbeafe; color: #1d4ed8; }
.badge-negociacao  { background: #fed7aa; color: #c2410c; }
.badge-documentos  { background: #fef3c7; color: #b45309; }
.badge-viavel      { background: #dcfce7; color: #15803d; }
.badge-inviavel    { background: #fee2e2; color: #b91c1c; }
.badge-descartado  { background: #f1f5f9; color: #475569; }
.badge-pendente    { background: #fef3c7; color: #b45309; }
.badge-ativo       { background: #dcfce7; color: #15803d; }
.badge-inativo     { background: #e5e7eb; color: #374151; }
.badge-suspenso    { background: #fee2e2; color: #b91c1c; }
.badge-modo        { background: #fef9ec; color: var(--gold); border: 1px solid var(--gold); }
.badge-parceiro    { background: #eef2ff; color: var(--navy); }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }

/* ===== KPI CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  border-left: 4px solid var(--navy);
}

.kpi-card.gold { border-left-color: var(--gold); }
.kpi-card.green { border-left-color: var(--success); }
.kpi-card.orange { border-left-color: var(--warning); }

.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: bold; color: var(--navy); line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== ALERTS / TOAST ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-info { background: #dbeafe; color: #1d4ed8; }
.alert-warning { background: #fef3c7; color: #b45309; }

/* Toast */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--navy); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: bold; color: var(--navy); }
.modal-close {
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ===== MAP ===== */
#map { height: calc(100vh - 120px); border-radius: var(--radius); overflow: hidden; }

.map-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

.map-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.map-container { flex: 1; }

/* ===== PIPELINE ===== */
.pipeline {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.pipeline-step {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.pipeline-step:hover { border-color: var(--navy); color: var(--navy); }
.pipeline-step.current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ===== GALLERY ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.gallery-item:hover img { transform: scale(1.05); }

/* ===== DEMAND CARD ===== */
.demand-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}
.demand-card:hover { border-color: var(--gold); }
.demand-card .demand-title { font-size: 15px; font-weight: bold; color: var(--navy); margin-bottom: 6px; }
.demand-card .demand-meta { font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 10px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ===== LOADING ===== */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.loading-overlay.hidden { display: none; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .brand {
  font-size: 36px;
  font-weight: bold;
  color: var(--navy);
  letter-spacing: 3px;
}

.login-logo .sub {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.login-logo .accent { color: var(--gold); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ===== PUBLIC PAGE (SHARED LINK) ===== */
.public-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.public-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-header .brand { font-size: 20px; font-weight: bold; color: var(--gold); letter-spacing: 2px; }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }
  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    color: var(--white);
    padding: 0 16px;
    height: var(--header-h);
    position: sticky; top: 0; z-index: 100;
  }

  .mobile-header .brand { font-size: 18px; font-weight: bold; color: var(--gold); letter-spacing: 2px; }

  .btn-menu {
    background: none; border: none;
    color: var(--white); font-size: 24px; cursor: pointer; padding: 4px;
  }

  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--navy);
    display: flex;
    height: var(--bottom-nav-h);
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    transition: color 0.2s;
    font-size: 10px;
    text-decoration: none;
    border: none; background: none; font-family: Arial, sans-serif;
  }

  .bottom-nav-item.active { color: var(--gold); }
  .bottom-nav-item .icon { font-size: 20px; }

  .page-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-body {
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
  }

  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .map-layout { flex-direction: column; }
  .map-sidebar { width: 100%; max-height: none; }
  #map { height: 50vh; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 769px) {
  .mobile-header { display: none; }
  .bottom-nav { display: none; }
  .sidebar-overlay { display: none !important; }
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

.filters-bar select, .filters-bar input {
  width: auto;
  min-width: 140px;
  padding: 8px 12px;
  font-size: 13px;
}

/* ===== MISC ===== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }

.section-title {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
