:root {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  --nav-dark: #1f3647;
  --nav-darker: #091726;
  --nav-active: #17354c;
  --bg: #eff1f3;
  --panel: #ffffff;
  --line: #d7dce1;
  --primary: #5f4b8b;
  --ui-text-scale: clamp(0.86, 0.72 + 0.55vw, 1);
}

* { box-sizing: border-box; }

html {
  font-size: clamp(13px, 0.35vw + 12px, 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: #1f2937;
}


body.chat-page-active {
  overflow: hidden;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 186px 1fr;
}

.sidebar {
  background: var(--nav-darker);
  color: #dbe6ef;
  display: grid;
  grid-template-rows: 1fr auto;
}

.main-menu {
  display: grid;
  align-content: start;
  padding-top: 50px;
}

.menu-item {
  cursor: pointer;
  font-size: 16px;
  font-weight: 300;
  overflow: hidden;
  padding: 8px 11px;
  text-decoration: none;
  color: #dee2e6;
  text-overflow: ellipsis;
  display: grid;
  grid-template-columns: 33px 1fr;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.menu-item.active {
  background: var(--nav-active);
}

.menu-icon-wrap {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
}

.menu-icon-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.menu-icon-fallback {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: #5ca9dd;
}

.menu-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo-box {
  padding: 18px 12px;
  min-height: 150px;
  display: grid;
  place-items: center;
}

.sidebar-logo {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.sidebar-logo-placeholder {
  color: #8ea2b5;
  font-size: 24px;
}

.main-area {
  display: grid;
  grid-template-rows: 46px 1fr;
}

/* Navbar */
.topbar {
  box-sizing: border-box;
  display: flex;
  flex-grow: 1;
  flex-shrink: 1;
  height: 46px;
  text-size-adjust: 100%;
  direction: ltr;
  color: rgb(255, 255, 255);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Ubuntu, "Noto Sans", Arial, "Odoo Unicode Support Noto", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  text-align: start;
  background: var(--nav-dark);
  align-items: center;
  gap: 26px;
  padding: 0 22px;
}

.topbar h1 {
  margin: 0;
  color: rgb(255, 255, 255);
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
}

.top-submenu {
  display: flex;
  gap: 26px;
  align-self: flex-end;
  padding-bottom: 8px;
}

.top-submenu-item {
  color: #d0dae3;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  padding-bottom: 8px;
  border-bottom: 3px solid transparent;
}

.top-submenu-item.active {
  color: #ffffff;
  border-bottom-color: #4f46e5;
}

.content {
  padding: 20px;
  display: grid;
  gap: 18px;
  max-width: none;
  width: min(1600px, calc(100% - 10px));
  margin: 0 auto;
}


.content.chat-content-mode {
  height: calc(100vh - 46px);
  max-width: none;
  width: min(1600px, calc(100% - 10px));
  overflow: hidden;
  align-content: stretch;
  padding-top: 12px;
  padding-bottom: 12px;
}

.content.dashboard-overview-mode {
  padding: 10px 14px;
  gap: 8px;
}

.panel {
  background: var(--panel);
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: clamp(20px, calc(24px * var(--ui-text-scale)), 24px);
  font-weight: 600;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.bank-category-colors-form {
  gap: 16px;
}

.bank-color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px 14px;
}

.bank-color-item {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.bank-color-swatch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  border: 1px solid #bfc8d1;
  border-radius: 6px;
  overflow: hidden;
}

.bank-color-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
}

label {
  display: grid;
  gap: 6px;
  font-size: clamp(13px, calc(15px * var(--ui-text-scale)), 15px);
  font-weight: 500;
}

input,
select,
textarea {
  border: 1px solid #bfc8d1;
  border-radius: 6px;
  padding: clamp(8px, 0.8vw, 10px);
  font-size: clamp(13px, calc(15px * var(--ui-text-scale)), 15px);
  background: #fff;
}

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

button {
  justify-self: start;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  padding: clamp(9px, 0.9vw, 11px) clamp(12px, 1.2vw, 16px);
  font-size: clamp(14px, calc(16px * var(--ui-text-scale)), 16px);
  font-weight: 600;
  cursor: pointer;
}

button:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  margin-top: 12px;
  color: #475569;
  font-size: clamp(12px, calc(14px * var(--ui-text-scale)), 14px);
}

.status {
  border-radius: 6px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
}

.status.ok {
  background: #dcfce7;
  color: #166534;
}

.status.error {
  background: #fee2e2;
  color: #991b1b;
}

.bank-status-line {
  margin: 0 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}


.asesoria-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.asesoria-actions-row.mt-10 {
  margin-top: 10px;
}

.button-like {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  text-decoration: none;
  font-weight: 600;
}

.button-like:hover {
  background: #f8fafc;
}

.odoo-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

.odoo-table th,
.odoo-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
  font-size: 14px;
}

.odoo-table th {
  font-weight: 600;
  color: #111827;
  background: #f8fafc;
}

.odoo-table th {
  position: relative;
  padding-right: 26px;
}

.table-col-resizer {
  position: absolute;
  top: 0;
  right: -2px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.table-col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: transparent;
}

.odoo-table th:hover .table-col-resizer::after,
body.col-resize-active .table-col-resizer::after {
  background: #cbd5e1;
}

body.col-resize-active,
body.col-resize-active * {
  cursor: col-resize !important;
  user-select: none !important;
}

.attach-badge {
  display: inline-block;
  min-width: 34px;
  max-width: 180px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.attach-badge.yes {
  background: #16a34a;
}

.attach-badge.no {
  background: #dc2626;
}

.chat-list {
  display: grid;
  gap: 12px;
}

.chat-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  padding: 12px;
}

.feedback-form {
  display: grid;
  gap: 8px;
}

.chatgpt-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding: 14px;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 18px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
  padding-bottom: 6px;
}

.chat-turn {
  display: grid;
  gap: 8px;
}

.chat-bubble {
  max-width: min(860px, 92%);
  border-radius: 18px;
  padding: 12px 16px;
  line-height: 1.45;
}

.user-bubble {
  margin-left: auto;
  background: #dbeafe;
  color: #0f3b6d;
}

.agent-bubble {
  background: #f8fafc;
  border: 1px solid #dbe3ec;
}

.agent-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.chat-actions {
  margin-top: 10px;
  color: #64748b;
  font-size: 14px;
}

.chat-feedback-form {
  max-width: min(860px, 92%);
}

.chat-correction-ok {
  max-width: min(860px, 92%);
}

.chat-composer {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 10px;
  background: #fff;
  position: sticky;
  bottom: 0;
}

.chat-composer input {
  border: none;
  padding: 6px 0;
  font-size: 22px;
  outline: none;
}

.chat-composer button {
  border-radius: 999px;
  padding: 10px 16px;
}

.composer-plus {
  font-size: 24px;
  color: #0f172a;
  text-align: center;
}




.bank-table {
  table-layout: fixed;
}

.bank-table .col-date { width: 124px; }
.bank-table .col-concept { width: auto; }
.bank-table .col-amount { width: 140px; }
.bank-table .col-category { width: 220px; }
.bank-table .col-reconciled { width: 110px; }
.bank-table .col-reconciled-with { width: 160px; }

#bank-movements-table .col-category { width: 190px; }
#bank-movements-table .col-reconciled { width: 95px; }
#bank-movements-table .col-reconciled-with { width: 170px; }
#bank-movements-table .col-concept { width: auto; }

.incidencias-table .col-date { width: 120px; }
.incidencias-table .col-amount { width: 130px; }
.incidencias-table .col-category { width: 140px; }
.incidencias-table .col-reconciled { width: 70px; }
.incidencias-table .col-action { width: 170px; }
.incidencias-table .col-concept { width: auto; }

.bank-table th,
.bank-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-upload-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bank-upload-form input[type="file"] {
  max-width: 260px;
}

.bank-category-select {
  width: 100%;
  max-width: 210px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  background: #ffffff;
}


.bank-category-edit-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
}

.bank-reconcile-form {
  margin: 0;
}

.category-toggle-button {
  background: #5b4b8a;
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 14px;
}

.category-toggle-button.active {
  background: #4c3d73;
}

.bank-category-edit-status {
  color: #16a34a;
  font-weight: 700;
}

.bank-category-text {
  display: inline-block;
  min-width: 120px;
}

.supplier-table {
  table-layout: fixed;
}

.supplier-table .col-date { width: 104px; }
.supplier-table .col-number { width: 190px; }
.supplier-table .col-asesoria { width: 132px; }
.supplier-table .col-supplier { width: 250px; }
.supplier-table .col-vat { width: 130px; }
.supplier-table .col-reference { width: 180px; }
.supplier-table .col-amount { width: 94px; }
.supplier-table .col-terms { width: 180px; }
.supplier-table .col-status { width: 112px; }
.supplier-table .col-attachment { width: 94px; }

.supplier-table th,
.supplier-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.supplier-invoice-number-cell {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
}

.supplier-terms-edit-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
}

.supplier-payment-terms-text {
  display: inline-block;
  min-width: 140px;
}

.supplier-payment-terms-select {
  width: 100%;
  max-width: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  background: #ffffff;
}


.bank-table .bank-category-select {
  display: none;
}

.bank-table.bank-category-edit-mode .bank-category-select {
  display: inline-block;
}

.bank-table.bank-category-edit-mode .bank-category-text {
  display: none;
}

.supplier-table .supplier-payment-terms-select {
  display: none;
}

.supplier-table.supplier-terms-edit-mode .supplier-payment-terms-select {
  display: inline-block;
}

.supplier-table.supplier-terms-edit-mode .supplier-payment-terms-text {
  display: none;
}

.odoo-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 34px;
}

.odoo-table th.sortable::after {
  content: "⇅";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 12px;
}

.odoo-table th.sorted-asc::after {
  content: "↑";
  color: #334155;
}

.odoo-table th.sorted-desc::after {
  content: "↓";
  color: #334155;
}

.supplier-table .truncate-cell {
  cursor: pointer;
}

.supplier-table td.supplier-provider-linked {
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  border-radius: 8px;
}

.payment-status.paid {
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  border-radius: 6px;
}

.asesoria-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.asesoria-status-badge.delivered {
  background: #16a34a;
  color: #ffffff;
}

.asesoria-status-badge.pending {
  background: #dc2626;
  color: #ffffff;
}


.purge-form {
  margin-top: 10px;
}


.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}
.danger-button {
  background: #b91c1c;
}

.danger-button:hover {
  background: #991b1b;
}

.invoices-title {
  margin: 0;
  font-size: 36px;
  font-weight: 500;
}

.table-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.search-filter-group {
  position: relative;
  width: 100%;
  display: grid;
  justify-items: center;
}

.bank-movements-count {
  margin-top: 8px;
  font-size: 13px;
  color: #334155;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  justify-self: center;
}

.asesoria-counts-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
}

.asesoria-counts-row .bank-movements-count {
  margin-top: 0;
}

.asesoria-counts-row .bank-movements-count.delivered {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  font-weight: 700;
}

.asesoria-table-actions {
  grid-template-columns: minmax(560px, 1fr) auto auto;
  justify-content: space-between;
  align-items: center;
}

.asesoria-left-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asesoria-left-tools .search-filter-group {
  flex: 1;
  width: auto;
  justify-items: stretch;
}

.asesoria-table-actions .table-search-wrap {
  width: 100%;
  justify-self: stretch;
}

.asesoria-listado-table {
  margin-top: clamp(12px, 4vw, 50px);
}

.icon-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.icon-action-btn:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.icon-action-adjuntos {
  color: #334155;
}

.icon-action-xls {
  color: #166534;
  font-size: 10px;
  letter-spacing: 0.4px;
}

.icon-action-delivered {
  justify-self: end;
}

.icon-action-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.asesoria-icon-preview-row {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.asesoria-icon-preview {
  width: 30px;
  height: 30px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 6px;
}

@media (max-width: 1180px) {
  .asesoria-table-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .asesoria-left-tools {
    width: 100%;
  }

  .asesoria-table-actions .asesoria-counts-row {
    justify-content: flex-start;
  }

  .asesoria-listado-table {
    margin-top: clamp(8px, 3vw, 24px);
  }

  .icon-action-delivered {
    justify-self: start;
  }
}

.table-search-wrap {
  display: grid;
  gap: 0;
  grid-template-columns: 40px 1fr 38px;
  align-items: center;
  width: min(620px, 100%);
  border: 1px solid #7aa7c3;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.table-search-icon,
.table-search-arrow {
  display: grid;
  place-items: center;
  color: #44566b;
  font-size: 16px;
}

.table-search-filter-button {
  border: none;
  border-left: 1px solid #7aa7c3;
  background: #f8fafc;
  color: #334155;
  height: 100%;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  border-radius: 0;
  padding: 0;
}

.table-search-filter-button:hover {
  background: #eef2f7;
}

.table-search {
  width: 100%;
  border: none;
  min-width: 0;
  max-width: none;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
}

.table-search::placeholder {
  color: #94a3b8;
}

.filter-menu[hidden] {
  display: none !important;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: max(calc((100% - min(620px, 100%)) / 2), 0px);
  z-index: 20;
  min-width: 260px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 10px;
}

.filter-menu label {
  font-size: 13px;
  font-weight: 600;
}

.filter-menu select {
  font-size: 13px;
  padding: 8px;
}


.agent-connection-status {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.agent-connection-status.ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.agent-connection-status.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.agent-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-button {
  background: #334155;
}

.secondary-button:hover {
  background: #1e293b;
}



.tickets-quick-panel {
  padding-top: 20px;
  padding-bottom: 20px;
}

.tickets-quick-panel .ticket-form-layout {
  margin-top: 8px;
  margin-bottom: 0;
}

.ticket-form-layout {
  display: grid;
  gap: 12px;
}

.ticket-row {
  display: grid;
  gap: 12px 16px;
  align-items: end;
}

.ticket-row-top {
  grid-template-columns: 200px minmax(300px, 1fr) 280px;
}

.ticket-row-bottom {
  grid-template-columns: minmax(420px, 1fr) 210px 210px auto;
}

.ticket-field {
  margin: 0;
}

.ticket-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: end;
}

.tickets-actions-single {
  grid-template-columns: 1fr;
}

.tickets-table {
  table-layout: fixed;
}

.tickets-table .col-date { width: 125px; }
.tickets-table .col-provider { width: 260px; }
.tickets-table .col-type { width: 145px; }
.tickets-table .col-amount { width: 140px; }
.tickets-table .col-notes { width: auto; }


@media (max-width: 1200px) {
  .ticket-row-top {
    grid-template-columns: 170px minmax(240px, 1fr) 220px;
  }

  .ticket-row-bottom {
    grid-template-columns: minmax(260px, 1fr) 190px 190px auto;
  }
}

@media (max-width: 980px) {
  .ticket-row-top,
  .ticket-row-bottom {
    grid-template-columns: 1fr 1fr;
  }

  .ticket-row-bottom .ticket-notes {
    grid-column: 1 / -1;
  }

  .ticket-row-bottom .ticket-action {
    grid-column: 1 / -1;
  }

  .ticket-form-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .ticket-row-top,
  .ticket-row-bottom {
    grid-template-columns: 1fr;
  }
}

.chat-thread::-webkit-scrollbar { width: 10px; }
.chat-thread::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }


.topbar-incidencias-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.topbar-incidencias-btn:hover {
  transform: translateY(-1px);
  background: rgba(148, 163, 184, 0.12);
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.25);
}

.topbar-incidencias-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-incidencias-icon svg {
  width: 22px;
  height: 22px;
  fill: #f8fafc;
  opacity: 0.95;
}

.topbar-incidencias-badge {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #0f172a;
  line-height: 1;
  letter-spacing: -0.15px;
}

.topbar-user-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}

.topbar-user-name {
  font-weight: 400;
  color: #ffffff;
  font-size: 22px;
}

.topbar-company-name {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-logout {
  border: none;
  border-radius: 10px;
  background: #334155;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

.inline-mini-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-mini-form input {
  min-width: 150px;
}

#users-table td {
  vertical-align: top;
}

.user-permissions-form {
  display: grid;
  gap: 8px;
  min-width: 430px;
}

.user-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 10px;
}

.user-permissions-item {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #334155;
}

.user-permissions-item select {
  min-width: 120px;
}

.user-permissions-label {
  font-weight: 600;
}

.user-permissions-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1220px) {
  .user-permissions-form {
    min-width: 300px;
  }
}

.login-page-body {
  margin: 0;
  min-height: 100vh;
  background: #d9b230;
  font-family: Inter, system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.login-shell {
  width: 100%;
  max-width: 560px;
  padding: 32px 20px;
}

.login-card {
  background: rgba(217, 178, 48, 0.96);
  border-radius: 22px;
  padding: 34px;
}

.login-card h1 {
  margin: 0 0 8px;
  color: #ffffff;
}

.login-subtitle {
  margin: 0 0 18px;
  color: #f9fafb;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #fff;
  font-size: 1.05rem;
}

.login-form input {
  border: 2px solid #f3f4f6;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  background: #c9d1df;
}

.login-submit {
  margin-top: 14px;
  border: none;
  border-radius: 18px;
  background: #2f5d79;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
}


.payment-status.paid-sync-error {
  background: #fecaca;
  color: #991b1b;
  font-weight: 700;
  border-radius: 6px;
}


.pago-agil-form {
  display: grid;
  gap: 6px;
}

.pago-agil-form select,
.pago-agil-form input {
  width: 100%;
  max-width: 360px;
}

.pago-agil-panel {
  padding: 18px 16px;
}

.pago-agil-header {
  align-items: center;
  gap: 16px;
}

.pago-agil-title {
  font-size: 36px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pago-agil-actions {
  flex: 1;
}

.pago-agil-hint {
  margin: 0;
}

.pago-agil-table tbody tr {
  border-top: 1px solid #d5deea;
}

.pago-agil-table .pago-agil-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr);
  gap: 8px;
  max-width: 210px;
}

.pago-agil-select,
.pago-agil-input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 44px;
  padding: 8px 10px;
  background: #f8fafc;
  font-size: 14px;
}

.pago-agil-button {
  border-radius: 8px;
  height: 44px;
  padding: 8px 14px;
  background: #5b4b8a;
  color: #fff;
  font-weight: 700;
}

.dashboard-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #eef2f7;
  border-color: #d7dde8;
  min-height: 0;
}

.dashboard-kpi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-kpi-grid .kpi-top-card {
  flex: 0 0 var(--top-kpi-width-desktop, 24%);
  max-width: var(--top-kpi-width-desktop, 24%);
  height: clamp(140px, calc(var(--top-kpi-height-desktop-vh, 22) * 1vh), 520px);
  min-height: clamp(140px, calc(var(--top-kpi-height-desktop-vh, 22) * 1vh), 520px);
}

.kpi-card {
  border: 1px solid #cfd8e3;
  background: #f7f9fc;
  border-radius: 16px;
  padding: 14px;
  box-shadow: none;
  --kpi-title-size: 22px;
  --kpi-title-color: #0F172A;
  --kpi-value-size: 38px;
  --kpi-value-color: #0F172A;
  --kpi-title-pad-left: 18px;
  --kpi-title-pad-top: 18px;
  --kpi-value-pad-left: 18px;
  --kpi-value-pad-top: 6px;
}


.kpi-top-card {
  position: relative;
  overflow: hidden;
  background: #f7f9fc;
  border-radius: 18px;
  aspect-ratio: auto;
  min-height: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.kpi-top-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -26px;
  width: 72%;
  height: 80px;
  background: radial-gradient(120% 100% at 80% 100%, rgba(100, 180, 101, 0.45) 0%, rgba(100, 180, 101, 0.18) 42%, rgba(100, 180, 101, 0) 70%);
  border-top-left-radius: 80px;
  pointer-events: none;
}

.kpi-top-card .kpi-head {
  margin-bottom: 8px;
  justify-content: flex-start;
}

.kpi-top-card .kpi-head h3 {
  font-size: var(--kpi-title-size);
  font-weight: 600;
  color: var(--kpi-title-color);
}

.kpi-top-card .kpi-value {
  font-size: var(--kpi-value-size);
  letter-spacing: 0.2px;
  margin: var(--kpi-value-pad-top) 0 0 var(--kpi-value-pad-left);
  text-align: left;
  color: var(--kpi-value-color);
}

.kpi-saldo-variation {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  font-size: clamp(0.8rem, 0.55rem + 0.6vw, 1.1rem);
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.kpi-saldo-variation .delta.up { color: #22c55e; }
.kpi-saldo-variation .delta.down { color: #dc2626; }

.kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--kpi-title-pad-top) 0 10px var(--kpi-title-pad-left);
}

.kpi-chip {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #e7eefc;
  font-size: 15px;
}


.kpi-head-with-control {
  justify-content: space-between;
  align-items: flex-start;
}

.kpi-month-form select {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 0.85rem;
  padding: 4px 8px;
}
.kpi-card h3 {
  margin: 0;
  font-size: var(--kpi-title-size);
  font-weight: 600;
  color: var(--kpi-title-color);
}

.kpi-value {
  margin: var(--kpi-value-pad-top) 0 0 var(--kpi-value-pad-left);
  font-size: var(--kpi-value-size);
  line-height: 1;
  font-weight: 700;
  color: var(--kpi-value-color);
}

.dashboard-bottom-grid {
  display: flex;
  margin-top: -1px;
  gap: 10px;
  align-items: stretch;
}

.dashboard-evolution {
  flex: 0 0 var(--evolution-width-desktop, 68%);
  max-width: var(--evolution-width-desktop, 68%);
  border: 1px solid #cfd8e3;
  border-radius: 16px;
  background: #f7f9fc;
  padding: 14px 14px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: clamp(180px, calc(var(--evolution-height-desktop-vh, 42) * 1vh), 900px);
  min-height: clamp(180px, calc(var(--evolution-height-desktop-vh, 42) * 1vh), 900px);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.dashboard-evolution h3 { margin: 0; font-size: 21px; }

.legend-row {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: #475569;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 4px;
}

.legend-dot.reconciled { background: #22c55e; }
.legend-dot.pending { background: #f59e0b; }
.legend-dot.total { background: #3b82f6; }


.evolution-line-chart {
  border-radius: 12px;
  padding: 10px 10px 6px;
  background: linear-gradient(to top, rgba(148, 163, 184, 0.06), rgba(148, 163, 184, 0.01) 55%, rgba(148, 163, 184, 0));
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.evolution-line-chart svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  flex: 1;
}

.evolution-line-chart .line {
  fill: none;
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.evolution-line-chart .line.reconciled,
.evolution-line-chart .point.reconciled { stroke: #16a34a; fill: #16a34a; }
.evolution-line-chart .line.total,
.evolution-line-chart .point.total { stroke: #f59e0b; fill: #f59e0b; }
.evolution-line-chart .line.pending,
.evolution-line-chart .point.pending { stroke: #ef4444; fill: #ef4444; }

.evolution-line-chart .area {
  stroke: none;
}

.evolution-line-chart .area.reconciled { fill: rgba(34, 197, 94, 0.18); }
.evolution-line-chart .area.total { fill: rgba(245, 158, 11, 0.18); }
.evolution-line-chart .area.pending { fill: rgba(239, 68, 68, 0.16); }

.evolution-month-axis {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  color: #64748b;
  font-size: 12px;
}

.evolution-month-axis span {
  text-align: center;
}
.mini-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 200px;
  background: linear-gradient(to top, rgba(59,130,246,0.05), transparent 55%);
  border-radius: 12px;
  padding: 12px 8px 6px;
}

.mini-bar-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  align-items: end;
}

.mini-bar {
  width: 100%;
  min-height: 8px;
  border-radius: 6px 6px 0 0;
}

.mini-bar.reconciled { background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%); }
.mini-bar.pending { background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%); }
.mini-bar.total { background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%); }

.mini-bar-group small {
  grid-column: 1 / span 3;
  text-align: center;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.dashboard-side-cards {
  display: grid;
  gap: 10px;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  flex: 1;
  min-width: 0;
  align-items: end;
}

.dashboard-conciliados-card {
  width: var(--conciliados-width-desktop, 100%);
}

.dashboard-incidencias-card {
  width: var(--incidencias-width-desktop, 100%);
}

.dashboard-side-cards .kpi-card {
  min-height: 235px;
}

.dashboard-conciliados-card {
  height: clamp(120px, calc(var(--conciliados-height-desktop-vh, 28) * 1vh), 700px);
  min-height: clamp(120px, calc(var(--conciliados-height-desktop-vh, 28) * 1vh), 700px);
}

.dashboard-incidencias-card {
  height: clamp(120px, calc(var(--incidencias-height-desktop-vh, 28) * 1vh), 700px);
  min-height: clamp(120px, calc(var(--incidencias-height-desktop-vh, 28) * 1vh), 700px);
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5efe8;
  overflow: hidden;
  margin-top: 8px;
}

.progress-track span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

@media (max-width: 1200px) {
  .dashboard-kpi-grid { justify-content: space-between; }
  .dashboard-kpi-grid .kpi-top-card {
    flex: 0 0 var(--top-kpi-width-mobile, 49%);
    max-width: var(--top-kpi-width-mobile, 49%);
    height: clamp(130px, calc(var(--top-kpi-height-mobile-vh, 20) * 1vh), 520px);
    min-height: clamp(130px, calc(var(--top-kpi-height-mobile-vh, 20) * 1vh), 520px);
  }
  .dashboard-bottom-grid { flex-direction: column; gap: 12px; }
  .dashboard-evolution {
    flex: 0 0 auto;
    max-width: 100%;
    width: var(--evolution-width-mobile, 100%);
  }
  .dashboard-side-cards { grid-template-rows: auto auto; }
  .dashboard-side-cards {
    width: 100%;
    align-items: start;
  }
  .dashboard-conciliados-card {
    width: var(--conciliados-width-mobile, 100%);
    height: clamp(120px, calc(var(--conciliados-height-mobile-vh, 26) * 1vh), 700px);
    min-height: clamp(120px, calc(var(--conciliados-height-mobile-vh, 26) * 1vh), 700px);
  }
  .dashboard-incidencias-card {
    width: var(--incidencias-width-mobile, 100%);
    height: clamp(120px, calc(var(--incidencias-height-mobile-vh, 26) * 1vh), 700px);
    min-height: clamp(120px, calc(var(--incidencias-height-mobile-vh, 26) * 1vh), 700px);
  }
  .dashboard-evolution {
    height: clamp(150px, calc(var(--evolution-height-mobile-vh, 36) * 1vh), 900px);
    min-height: clamp(150px, calc(var(--evolution-height-mobile-vh, 36) * 1vh), 900px);
  }
  .dashboard-bg-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 740px) {
  .chart-head { flex-direction: column; align-items: flex-start; }
  .mini-bars { grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 180px; }
  .evolution-line-chart svg { min-height: 0; }
  .kpi-top-card { aspect-ratio: auto; min-height: 0; }
  .dashboard-kpi-grid .kpi-top-card {
    flex-basis: var(--top-kpi-width-mobile, 100%);
    max-width: var(--top-kpi-width-mobile, 100%);
  }
  .dashboard-bottom-grid { margin-top: 0; }
  .dashboard-evolution { min-height: clamp(150px, calc(var(--evolution-height-mobile-vh, 36) * 1vh), 900px); }
  .dashboard-side-cards { grid-template-rows: auto auto; }
  .dashboard-bg-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}



.dashboard-bg-preview-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-bg-preview-item {
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.dashboard-bg-preview-item h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #334155;
}

.dashboard-bg-preview-item img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.dashboard-side-cards .kpi-card {
  padding: 12px 14px 12px 14px;
  height: 100%;
  min-height: 235px;
}


.dashboard-preview-card {
  aspect-ratio: 1.2 / 1;
  min-height: 0;
}

.dashboard-preview-card::after {
  opacity: 0.65;
}


.dashboard-text-style-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.dashboard-text-style-grid label {
  margin: 0;
}

.dashboard-preview-card {
  transition: transform .15s ease, box-shadow .15s ease;
}

.dashboard-preview-card.is-active-preview {
  outline: 2px solid #7c3aed;
  transform: translateY(-2px);
}

@media (max-width: 1400px) {
  .dashboard-text-style-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
}

@media (max-width: 900px) {
  .dashboard-text-style-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 900px) {
  .content,
  .content.chat-content-mode {
    width: calc(100% - 24px);
  }
}

@media (max-width: 680px) {
  .dashboard-text-style-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}


.incidencias-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.incidencias-actions-cell form {
  margin: 0;
}

.primary-button {
  background: #166534;
}

.primary-button:hover {
  background: #14532d;
}
