/* =============================================
   Conquista Frota — Estilos base
   ============================================= */

:root {
  --win-bg: #e8ebef;
  --border: #a8afb8;
  --dark-border: #777f89;
  --blue: #315e86;
  --blue2: #d7e6f3;
  --green: #3d7650;
  --text: #20252a;
  --toolbar: #f5f6f7;
  --row: #fff;
  --selected: #cfe4f6;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font: 12px "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background: #7e8a96;
}

button, input, select {
  font: inherit;
}

/* =============================================
   Shell do desktop
   ============================================= */

.desktop-shell {
  height: 100vh;
  min-width: 1000px;
  display: grid;
  grid-template-rows: 50px 29px 54px 1fr 24px;
  background: var(--win-bg);
  border: 1px solid #626b75;
  overflow: hidden;
}

/* =============================================
   Barra de título
   ============================================= */

.titlebar {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  background: linear-gradient(#f8fafc, #cdd3da);
  border-bottom: 1px solid #9da4ac;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-right: 9px;
  background: linear-gradient(135deg, #274e72, #5b89af);
  color: #fff;
  font-weight: 800;
  border: 1px solid #183a59;
  box-shadow: inset 0 0 0 2px #8eabc2;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  color: #254b6b;
  letter-spacing: .4px;
}

.brand-copy b {
  font-size: 15px;
}

.brand-copy span {
  font-size: 10px;
  color: #9b3a30;
  letter-spacing: 1.5px;
}

/* Controles de janela */

.window-controls {
  margin-left: auto;
  align-self: flex-start;
  display: flex;
}

.window-controls button {
  width: 32px;
  height: 22px;
  border: 1px solid #9aa2aa;
  background: linear-gradient(#fff, #dce0e5);
  margin-left: 2px;
}

.window-controls .close:hover {
  background: #c74a42;
  color: white;
}

/* =============================================
   Barra de menus
   ============================================= */

.menubar {
  display: flex;
  align-items: stretch;
  background: #f4f4f4;
  border-bottom: 1px solid #aeb3b8;
  padding-left: 5px;
}

.menubar button {
  border: 0;
  background: transparent;
  padding: 0 11px;
}

.menubar button:hover,
.menubar button.active {
  background: #dce8f2;
  border-left: 1px solid #a5b5c4;
  border-right: 1px solid #a5b5c4;
}

/* =============================================
   Dropdown
   ============================================= */

.dropdown {
  position: fixed;
  display: none;
  z-index: 20;
  min-width: 220px;
  padding: 3px;
  background: #f7f7f7;
  border: 1px solid #7d858e;
  box-shadow: 3px 4px 8px #0004;
}

.dropdown.open {
  display: block;
}

.dropdown button {
  display: block;
  width: 100%;
  padding: 7px 28px 7px 24px;
  text-align: left;
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.dropdown button:hover {
  background: #2d6fa5;
  color: white;
}

.dropdown hr {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 3px;
}

/* =============================================
   Quickbar
   ============================================= */

.quickbar {
  display: flex;
  align-items: stretch;
  padding: 4px 7px;
  background: linear-gradient(#f7f8f9, #d9dde1);
  border-bottom: 1px solid #9da5ae;
}

.quickbar button {
  min-width: 72px;
  border: 0;
  border-right: 1px solid #c0c5ca;
  background: transparent;
  padding: 2px 10px;
  color: #27333e;
}

.quickbar button:hover {
  background: #fff8;
  border: 1px solid #9fb6ca;
}

.quickbar span {
  display: block;
  font-size: 20px;
  line-height: 21px;
}

/* =============================================
   Área de trabalho
   ============================================= */

.workspace {
  position: relative;
  overflow: hidden;
  background: #dfe3e7;
  padding: 5px;
}

/* =============================================
   Telas
   ============================================= */

.screen {
  display: none;
  height: 100%;
  border: 1px solid #8f969e;
  background: #eef0f2;
  box-shadow: inset 0 0 0 1px #fff;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.screen-title {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 9px;
  background: linear-gradient(#fefefe, #d7dbe0);
  border-bottom: 1px solid #a4aab1;
}

.screen-title b {
  color: #294e6c;
  font-size: 13px;
}

.screen-title span {
  color: #747a80;
}

/* =============================================
   Toolbar
   ============================================= */

.toolbar {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  background: #f8f9fa;
  border-bottom: 1px solid #bcc2c8;
}

.toolbar button,
.modal-actions button {
  height: 27px;
  padding: 0 10px;
  border: 1px solid #aab1b7;
  background: linear-gradient(#fff, #e0e4e8);
  box-shadow: inset 0 0 0 1px #fff;
}

.toolbar button:hover,
.modal-actions button:hover {
  border-color: #6589a6;
  background: #e6f1f9;
}

.toolbar .primary,
.primary {
  color: #153c5c;
  font-weight: 600;
}

.toolbar .danger,
.danger {
  color: #8d241d;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar select {
  height: 24px;
  border: 1px solid #a8afb5;
  background: #fff;
}

/* =============================================
   Dashboard
   ============================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: 310px 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  min-height: 0;
  flex: 1;
}

.panel {
  min-height: 0;
  background: #fff;
  border: 1px solid #aab1b8;
  overflow: auto;
}

.panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 8px;
  font-weight: 600;
  color: #294d6d;
  background: linear-gradient(#f6f8fa, #dce2e7);
  border-bottom: 1px solid #b4bac0;
}

.followup {
  grid-row: 1 / 3;
}

.metrics {
  grid-column: 2 / 4;
}

.funnel {
  grid-column: 2 / 4;
}

.follow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #d8dce0;
}

.follow-item:hover {
  background: #eaf3fa;
}

.follow-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.follow-item > div {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.follow-item b {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #2c3e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.follow-item span {
  display: block;
  color: #6d747b;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
}

.metric {
  height: 73px;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid #afbac4;
  background: linear-gradient(135deg, #fff, #e7eef4);
  color: #294d6b;
}

.metric span {
  display: block;
  font-size: 22px;
  font-weight: 700;
}

.metric small {
  color: #606a73;
}

.metric.warning span {
  color: #aa3d2f;
}

.metric.success span {
  color: #38714a;
}

/* =============================================
   Tabelas
   ============================================= */

.panel table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.panel th,
.panel td,
.data-table th,
.data-table td {
  padding: 5px 7px;
  border-right: 1px solid #d5d9dd;
  border-bottom: 1px solid #d7dbdf;
  text-align: left;
}
.data-table th {
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.panel th,
.data-table th {
  font-weight: 500;
  background: linear-gradient(#f9fafb, #e1e5e8);
  border-bottom: 2px solid #aeb5bc;
}

.bars {
  padding: 10px;
}

.bars div {
  margin-bottom: 8px;
}

.bars label {
  display: flex;
  justify-content: space-between;
}

.bars i {
  display: block;
  width: var(--w);
  height: 10px;
  background: linear-gradient(90deg, #345f83, #79a0bd);
  border: 1px solid #325b7e;
}

/* =============================================
   Layout com filtros e tabela
   ============================================= */

.list-layout {
  display: grid;
  grid-template-columns: 205px 1fr;
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}


.filter-panel {
  padding: 7px;
  background: #e9edf0;
  overflow: auto;
  position: sticky;
  top: 0;
  align-self: start;
  z-index: 3;
  border-right: 1px solid #bcc2c8;
  border-bottom: 1px solid #bcc2c8;
}
.filter-panel h3 {
  font-size: 11px;
  color: #36566f;
  margin: 2px -3px 7px;
  padding: 5px;
  background: #d7e1e9;
  border: 1px solid #b4c0ca;
}

.filter-panel label:not(.check) {
  display: block;
  margin: 7px 0 2px;
}

.filter-panel input,
.filter-panel select {
  width: 100%;
  height: 24px;
  border: 1px solid #aeb4ba;
  background: #fff;
}

.filter-panel button.full {
  width: 100%;
  height: 27px;
  margin-top: 7px;
  border: 1px solid #9ba9b5;
  background: linear-gradient(#fff, #dce5ec);
}

.check {
  display: block;
  margin: 6px 0;
}

.table-wrap {
  min-width: 0;
  background: #fff;
  position: relative;
}
.table-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: #adb4bb;
  z-index: 1;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
  background: var(--selected);
}

.data-table tbody tr:nth-child(even) {
  background: #f8fafb;
}

.data-table tbody tr:nth-child(even):hover {
  background: var(--selected);
}

.grid-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  background: #e8ebee;
  border-top: 1px solid #aeb4ba;
}

/* =============================================
   Kanban
   ============================================= */

.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 7px;
  overflow: auto;
  flex: 1;
}

.kanban-col {
  min-width: 170px;
  background: #e3e7ea;
  border: 1px solid #adb4ba;
}

.kanban-head {
  padding: 7px;
  font-weight: 600;
  color: #2a506e;
  background: linear-gradient(#f9fafb, #dbe1e6);
  border-bottom: 1px solid #adb4ba;
}

.lead-card {
  margin: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid #b7bdc3;
  box-shadow: 1px 1px 2px #0002;
}

.lead-card b {
  display: block;
}

.lead-card small {
  display: block;
  color: #687078;
  margin-top: 4px;
}

.lead-card .hot {
  color: #a43b2e;
}

/* =============================================
   Abas
   ============================================= */

.tabs {
  display: flex;
  padding: 4px 5px 0;
  background: #e6e9ec;
  border-bottom: 1px solid #9fa7ae;
}

.tabs button {
  padding: 6px 10px;
  border: 1px solid #aeb4ba;
  border-bottom: 0;
  background: #dadddf;
}

.tabs button.active {
  position: relative;
  top: 1px;
  background: #fff;
}

/* =============================================
   Contratos
   ============================================= */

.contract-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 8px;
  overflow: auto;
}

fieldset {
  min-width: 0;
  border: 1px solid #aeb5bb;
  background: #f8f9fa;
}

legend {
  color: #315b7a;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.form-grid label {
  font-size: 11px;
}

.form-grid input,
.form-grid select {
  display: block;
  width: 100%;
  height: 24px;
  margin-top: 2px;
  border: 1px solid #aab1b7;
  background: #fff;
}

.form-grid .span2 {
  grid-column: span 2;
}

.contract-grid > fieldset.span2 {
  grid-column: span 2;
}

/* =============================================
   Badges
   ============================================= */

.badge {
  display: inline-block;
  min-width: 62px;
  text-align: center;
  padding: 2px 5px;
  border: 1px solid;
}

.badge.green {
  background: #dff0df;
  color: #276238;
  border-color: #91b99b;
}

.badge.red {
  background: #f5dddd;
  color: #8d2924;
  border-color: #d19b97;
}

.badge.blue {
  background: #deebf5;
  color: #315d80;
  border-color: #9eb8cc;
}

.badge.gray {
  background: #eceeef;
  color: #666;
  border-color: #bbb;
}

.overdue {
  background: #fff0ef !important;
}

/* =============================================
   Permissões
   ============================================= */

.permissions-head {
  display: flex;
  gap: 30px;
  padding: 10px;
  background: #f4f5f6;
  border-bottom: 1px solid #b6bcc1;
}

.permissions-head label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.permissions-head select {
  width: 250px;
  height: 25px;
}

.permission-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  min-height: 0;
  flex: 1;
}

.permission-grid > div {
  border: 1px solid #aab1b7;
  background: #fff;
  overflow: auto;
}

.permission-grid h3 {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 6px;
  background: #e1e6ea;
  border-bottom: 1px solid #aeb5bb;
  font-size: 11px;
}

.tree label,
.users label {
  display: block;
  padding: 4px 8px;
  border-bottom: 1px solid #edf0f2;
}

.tree .level2 {
  padding-left: 28px;
}

.tree .level3 {
  padding-left: 49px;
}

.users {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* =============================================
   Módulo placeholder
   ============================================= */

.placeholder-module {
  margin: 10px;
  padding: 20px;
  border: 1px solid #aab1b7;
  background: #fff;
  color: #52606b;
}

/* =============================================
   Barra de status
   ============================================= */

.statusbar {
  display: flex;
  align-items: center;
  background: #e7eaed;
  border-top: 1px solid #9ea5ac;
}

.statusbar span {
  padding: 0 12px;
  border-right: 1px solid #b3bac0;
}

.statusbar .status-online {
  margin-left: auto;
  color: #2c7544;
}

/* =============================================
   Toast
   ============================================= */

.toast {
  position: fixed;
  right: 18px;
  bottom: 38px;
  z-index: 50;
  padding: 10px 15px;
  background: #284f6d;
  color: #fff;
  border: 1px solid #17384f;
  box-shadow: 2px 3px 8px #0005;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: none;
}

/* =============================================
   Modal
   ============================================= */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #0004;
  place-items: center;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: 540px;
  background: #e9ecef;
  border: 1px solid #646c74;
  box-shadow: 6px 8px 18px #0006;
}

.modal-title {
  height: 31px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  background: linear-gradient(#f7f8f9, #ccd2d8);
  border-bottom: 1px solid #90979e;
}

.modal-title button {
  margin-left: auto;
  height: 25px;
  width: 31px;
  border: 0;
  background: transparent;
}

.modal-body {
  padding: 12px;
}

.modal-body .form-grid {
  grid-template-columns: 1fr 1fr;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  padding: 7px;
  border-top: 1px solid #b4bac0;
  background: #f4f5f6;
}

/* =============================================
   Responsivo
   ============================================= */

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 280px 1fr;
  }

  .metrics {
    grid-column: 2;
  }

  .funnel {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
