:root {
  --blue-980: #1b446c;
  --blue-930: #1f4f7d;
  --blue-860: #2a5f90;
  --blue-800: #2f6f9f;
  --blue-720: #2f6f9f;
  --blue-500: #6faad2;
  --ice-100: #f2f8ff;
  --ice-50: #f8fbff;
  --white: #ffffff;
  --ink: #102132;
  --muted: #4e6377;
  --line: #c9dced;
  --accent-ok: #2dbd6e;
  --accent-login: #2f6f9f;
  --accent-error: #d64141;
  --warning: #ffd464;
  --series-sales: #2f6f9f;
  --series-iva: #e3b735;
  --series-expenses: #d64e4e;
  --series-net: #2dbd6e;
  --shadow: 0 16px 28px rgba(9, 29, 49, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
}

body {
  background: linear-gradient(130deg, #d8ecff 0%, #eff7ff 42%, #f8fcff 100%);
}

body.auth-only .print-modal,
body.auth-only .busy-overlay {
  display: none !important;
}

body.auth-only {
  overflow: hidden;
}

body.auth-only .shell {
  grid-template-columns: 1fr;
  width: min(720px, 96vw);
  margin: 0 auto;
  min-height: calc(100vh - 64px);
}

body.auth-only .workspace {
  width: 100%;
}

body.auth-only .auth-screen {
  min-height: calc(100vh - 64px);
  place-items: center;
  overflow: hidden;
}

body.busy-cursor,
body.busy-cursor * {
  cursor: progress !important;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 7%, rgba(32, 85, 132, 0.24), transparent 38%),
    radial-gradient(circle at 84% 8%, rgba(111, 170, 210, 0.2), transparent 41%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(33, 79, 121, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.brand-copy {
  display: grid;
  gap: 0;
}

.brand-copy strong {
  line-height: 1;
}

.brand-copy small {
  color: #b5d5f1;
  line-height: 1;
}

.brand-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.brand-dot.state-login {
  background: var(--accent-login);
}

.brand-dot.state-connected {
  background: var(--accent-ok);
}

.brand-dot.state-error {
  background: var(--accent-error);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 10px;
}

.pill.muted {
  color: #d9ecff;
  background: rgba(44, 86, 123, 0.9);
  border: 1px solid rgba(142, 185, 219, 0.5);
}

.shell {
  width: calc(100% - 32px);
  margin: 14px 16px 18px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  transition: grid-template-columns 0.22s ease;
}

.sidebar-expanded .shell {
  grid-template-columns: 252px minmax(0, 1fr);
}

.global-progress {
  position: sticky;
  top: 64px;
  z-index: 31;
  height: 24px;
  background: rgba(33, 79, 121, 0.9);
  border-bottom: 1px solid rgba(181, 213, 241, 0.28);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.global-progress-bar {
  height: 8px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6faad2 0%, #96f2c6 100%);
  transition: width 0.2s ease;
}

.global-progress-text {
  color: #d9ecff;
  font-size: 0.77rem;
  font-weight: 700;
}

.sidebar {
  width: 100%;
  height: calc(100vh - 92px);
  max-height: calc(100vh - 92px);
  background: linear-gradient(180deg, #2f73a8 0%, #22527d 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  transition: width 0.2s ease;
  position: sticky;
  top: 78px;
  align-self: start;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.sidebar:hover {
  width: 100%;
}

.sidebar-title {
  height: 62px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e7f3ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px;
}

.sidebar-title span {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.sidebar:hover .sidebar-title span {
  opacity: 1;
}

.sidebar-nav {
  padding: 9px;
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  align-content: start;
}

.sidebar-version {
  margin: auto 9px 10px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(192, 222, 247, 0.22);
  text-align: right;
}

.sidebar-version span {
  display: inline-block;
  color: #d8ecff;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s ease, width 0.15s ease;
}

.sidebar:hover .sidebar-version span,
.sidebar-expanded .sidebar .sidebar-version span {
  opacity: 1;
  width: auto;
}

.sidebar-separator {
  height: 1px;
  background: rgba(192, 222, 247, 0.28);
  margin: 8px 4px;
}

.module-link {
  border: 1px solid rgba(157, 200, 232, 0.2);
  background: rgba(21, 55, 86, 0.4);
  color: #e3f4ff;
  border-radius: 12px;
  min-height: 46px;
  padding: 8px 9px;
  font: inherit;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.module-link img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
  flex: 0 0 22px;
}

.module-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  text-align: left;
  text-overflow: ellipsis;
}

.sidebar:hover .module-link span {
  opacity: 1;
  width: auto;
}

.module-link:hover {
  transform: translateX(1px);
  background: rgba(69, 129, 178, 0.52);
  border-color: rgba(179, 215, 242, 0.5);
}

.module-link.active {
  background: #d4ebff;
  color: #184468;
  border-color: #95c6ea;
}

.module-link.disabled,
.module-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.module-link.danger {
  background: rgba(123, 45, 34, 0.45);
  border-color: rgba(228, 154, 143, 0.4);
}

.workspace {
  min-width: 0;
  width: 100%;
}

.auth-screen {
  min-height: calc(100vh - 112px);
  display: grid;
  place-items: center;
  gap: 12px;
}

.card {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-lite {
  border: 1px solid #d2e5f5;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.auth-card {
  width: min(560px, 94vw);
}

.auth-card h1,
.auth-card h2,
.view h2 {
  margin: 0 0 10px;
  color: var(--blue-930);
}

.auth-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#productoForm,
#servicioForm,
#presupuestoForm {
  align-items: start;
}

#productoForm > label,
#servicioForm > label,
#presupuestoForm > label {
  align-self: start;
}

#agendaForm {
  align-items: start;
}

.agenda-editor {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(360px, 1fr);
  gap: 12px;
  align-items: start;
}

.agenda-main-fields {
  display: grid;
  gap: 10px;
}

.agenda-description-panel {
  min-height: 100%;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: #27465f;
  font-size: 0.87rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b8d7ef;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input[readonly] {
  background: #edf4fb;
  color: #43637f;
}

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

.agenda-description-field textarea {
  width: 100%;
  min-height: 300px;
  resize: none;
  line-height: 1.45;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(180deg, #cfe3f4, #eef7ff) border-box;
  box-shadow: 0 10px 20px rgba(24, 68, 104, 0.08);
}

.compact-grid {
  gap: 8px;
}

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

.required-visual {
  background: #fff8cf !important;
}

input:required,
select:required,
textarea:required {
  background: #fff8cf;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #8bc2ea;
  border-color: transparent;
}

.required-missing {
  border-color: #d3a700 !important;
  background: #ffef96 !important;
  outline: 2px solid #ffd03d !important;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 46px;
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid #c6dff2;
  background: #eff8ff;
  border-radius: 8px;
  width: 32px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.toggle-password img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  background: #96f2c6;
  color: #0b3b20;
}

.btn-soft {
  background: #f9e8a5;
  color: #4c3c08;
}

.btn-ghost {
  background: #e6f3ff;
  color: #234f73;
}

.row-actions {
  margin: 11px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#empresaView .row-actions {
  margin-top: 8px;
}

.module-toolbar {
  margin: 2px 0 10px;
}

.search-field {
  max-width: 460px;
}

.search-field input[type="search"] {
  border-radius: 999px;
  border-color: #9ec6e5;
  padding-inline: 14px;
  background: #f7fbff;
}

.row-actions.compact {
  margin: 4px 0 0;
}

.auth-actions {
  justify-content: flex-start;
}

.remember-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2b4f6d;
  font-size: 0.84rem;
  margin-top: 3px;
}

.remember-check input {
  width: auto;
}

.btn-register {
  margin-left: 8px;
}

.app {
  display: grid;
  gap: 16px;
}

.company-info {
  background: linear-gradient(180deg, #eff7ff 0%, #ffffff 100%);
}

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

.stats article {
  background: #fff;
  border: 1px solid #d5e8f6;
  border-radius: 12px;
  padding: 7px 8px;
}

.stats h3 {
  margin: 0 0 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #4a6d8d;
}

.stats p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.14;
  font-weight: 700;
  color: var(--blue-930);
}

.home-shortcuts {
  align-items: stretch;
  padding: 8px !important;
}

.home-shortcut-card {
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  border: 1px solid #d5e8f6;
  border-radius: 12px;
  padding: 7px 8px;
  background: #fff;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.home-shortcut-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 79, 116, 0.12);
  border-color: #86bbdf;
}

.home-shortcut-card h3,
.home-subscription-card h3 {
  margin: 0 0 3px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #4a6d8d;
}

.home-shortcut-card p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.12;
  font-weight: 700;
  color: var(--blue-930);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-subscription-card {
  min-height: 72px;
  background: #fff;
  border: 1px solid #d5e8f6;
  border-radius: 12px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-modules-status-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 2px;
  color: #234f73;
  font-size: 0.73rem;
  line-height: 1.14;
}

.home-modules-status-list li {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.dashboard-grid.dashboard-bottom {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 20px;
}

#dashboardView > .trend-card {
  margin-bottom: 20px;
}

.chart-card {
  border: 1px solid #d2e5f4;
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  box-shadow: 0 14px 28px rgba(23, 63, 93, 0.1);
  position: relative;
  overflow: hidden;
}

.chart-card h3 {
  margin: 0 0 8px;
  color: #2a5377;
}

.trend-card {
  overflow: hidden;
  min-height: 0;
  transition: margin-bottom 0.32s ease, padding 0.28s ease;
}

.trend-card.collapsed {
  min-height: 0;
}

#dashboardView > .trend-card.collapsed {
  margin-bottom: 8px;
}

.trend-card canvas {
  max-height: 720px;
  opacity: 1;
  transform: scaleY(1);
  transform-origin: top center;
  transition:
    height 0.34s ease,
    max-height 0.34s ease,
    min-height 0.34s ease,
    opacity 0.22s ease,
    transform 0.34s ease,
    border-width 0.22s ease,
    margin-top 0.34s ease;
}

.trend-card.collapsed canvas {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  transform: scaleY(0.98);
  border-width: 0;
  pointer-events: none;
}

.trend-card.collapsed .chart-head {
  margin-bottom: 0;
}

#dashboardView .dashboard-grid.dashboard-bottom .chart-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr) auto;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.chart-head-actions {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.series-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 6px 10px;
  font-size: 0.74rem;
  line-height: 1;
}

.series-pill {
  border: 1px solid #bfd8ed;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #234c6d;
  background: #f4fbff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.series-pill input {
  width: auto;
  margin: 0;
}

.series-pill.sales {
  border-color: rgba(47, 111, 159, 0.45);
  color: #1f4f74;
}

.series-pill.iva {
  border-color: rgba(227, 183, 53, 0.45);
  color: #77590b;
}

.series-pill.expenses {
  border-color: rgba(214, 78, 78, 0.45);
  color: #7a2c2c;
}

.series-pill.net {
  border-color: rgba(45, 189, 110, 0.45);
  color: #17603b;
}

.chart-card canvas {
  width: 100%;
  display: block;
  height: 320px;
  min-height: 280px;
  border: 1px solid #e6f1fb;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfeff 0%, #f1f8ff 100%);
}

#monthlyChart {
  height: min(68vh, 700px);
  min-height: 420px;
}

#topItemsChart {
  height: 100%;
  min-height: 430px;
}

#dashboardView .dashboard-grid.dashboard-bottom canvas {
  min-height: 430px;
}

.chart-card.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 45%, transparent 100%);
  animation: shimmer 0.65s linear infinite;
  pointer-events: none;
}

.chart-hint {
  margin: 6px 0 0;
  color: #577089;
  font-size: 0.78rem;
}

.top-clientes-cards {
  display: grid;
  gap: 10px;
  height: 100%;
  min-height: 320px;
  overflow: auto;
  align-content: start;
}

.top-cliente-card {
  border: 1px solid #cfe3f4;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fcff 0%, #eef7ff 100%);
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  animation: fadeUpIn 0.35s ease both;
}

.top-cliente-card:hover {
  transform: translateY(-1px);
  border-color: #86bbdf;
  box-shadow: 0 8px 18px rgba(26, 70, 103, 0.14);
}

.top-cliente-card h4 {
  margin: 0 0 4px;
  color: #244c6d;
  font-size: 0.95rem;
}

.top-cliente-card p {
  margin: 0;
  color: #48647e;
  font-size: 0.78rem;
  line-height: 1.3;
}

.table-wrap {
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #d3e6f5;
  border-radius: 12px;
  background: #fff;
}

.table-wrap.slim {
  max-height: 340px;
}

.logo-preview-wrap {
  border: 1px dashed #9ec6e5;
  border-radius: 12px;
  padding: 10px;
  background: #f7fcff;
  min-height: 88px;
  display: grid;
  place-items: center;
}

.logo-preview {
  max-height: 72px;
  max-width: min(360px, 100%);
  object-fit: contain;
}

.config-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 0.85fr) minmax(380px, 1.25fr);
  gap: 12px;
}

.config-grid > .full {
  grid-column: 1 / -1;
}

.commercial-year-card {
  grid-column: 1;
}

.commercial-year-card .compact-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

.config-combos-card {
  grid-column: 2 / 4;
}

.config-combos-card .grid-2 {
  gap: 8px;
}

.config-combos-card .row-actions {
  gap: 8px;
}

.config-combos-card .table-wrap.slim {
  max-height: 180px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #254a68;
}

.checkbox-row input {
  width: auto;
}

.char-counter {
  display: block;
  text-align: right;
  font-size: 0.74rem;
  font-weight: 700;
  color: #5c7388;
}

.compact-counter-field {
  position: relative;
}

.compact-counter-field input {
  padding-right: 52px;
}

.compact-counter-field .char-counter {
  position: absolute;
  right: 10px;
  bottom: 11px;
  line-height: 1;
  pointer-events: none;
}

.flag-btn img {
  width: 30px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
}

.top-gap {
  margin-top: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #ebf3fa;
  text-align: left;
  font-size: 0.84rem;
  white-space: normal;
  word-break: break-word;
}

th.selection-col,
td.selection-cell {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
  text-align: center;
  white-space: nowrap;
}

td.selection-cell {
  vertical-align: middle;
}

td.selection-cell .row-select {
  margin: 0 auto;
  display: block;
}

.line-actions {
  justify-content: flex-start;
  margin-top: 4px;
}

.lineas-wrap {
  max-height: 220px;
}

th {
  background: #f5fbff;
  color: #2a5276;
  position: sticky;
  top: 0;
  z-index: 1;
}

.action-btn {
  border: 1px solid #afd0eb;
  background: #ebf6ff;
  color: #1d4b70;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.action-btn.danger {
  border-color: #e8b0a9;
  background: #faece9;
  color: #7a2f25;
}

.action-btn.ok {
  border-color: #9fd8b6;
  background: #e9f9ee;
  color: #1d6a3c;
}

.action-btn.nomina-action-main {
  border-color: #7ad4a3;
  background: #dbf8e8;
  color: #13512f;
  font-weight: 800;
  padding-inline: 12px;
}

.action-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.btn-mini-select {
  padding: 0.38rem 0.62rem;
  font-size: 0.76rem;
  line-height: 1.05;
  border-radius: 10px;
}

.rectify-notice {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #f3d98a;
  background: #fff8de;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rectify-notice span {
  color: #6d5515;
  font-weight: 700;
}

.row-payment-pendiente {
  background: #fbe3e3;
}

.row-payment-pagada {
  background: #def4e2;
}

.row-invoice-rectificativa {
  background: #ffe6c7;
}

.row-state-pendiente {
  background: #ffe9cb;
}

.row-state-encurso {
  background: #d2e3f7;
}

.row-state-hecho {
  background: #d6eedb;
}

.row-presupuesto-realizado {
  background: #d9e8f8;
}

.row-presupuesto-enviado {
  background: #ffe9cb;
}

.row-presupuesto-aceptado {
  background: #d6eedb;
}

.row-presupuesto-rechazado {
  background: #f7d6d6;
}

.agenda-shell {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(300px, 1fr);
  gap: 12px;
  margin-bottom: 10px;
}

#agendaForm.agenda-editor {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(300px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.agenda-date-field input[type="date"],
#agendaHoraInput {
  min-height: 42px;
}

#agendaHoraInput {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.agenda-time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 2px;
}

.time-chip {
  border: 1px solid #9bc4e4;
  background: #edf7ff;
  color: #1f4e72;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
}

.time-chip:hover {
  background: #dff0ff;
}

#showRegisterBtn[hidden] {
  display: none !important;
}

.empresa-readonly input,
.empresa-readonly select,
.empresa-readonly textarea {
  background: #edf4fb !important;
  color: #45627d;
  pointer-events: none;
}

.empresa-readonly .logo-preview-wrap {
  opacity: 0.9;
}

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

.calendar-header strong {
  color: #234f73;
}

.calendar-legend {
  color: #5c7388;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-weekday,
.calendar-day {
  text-align: center;
  border-radius: 8px;
  min-height: 34px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
}

.calendar-weekday {
  background: #f2f8ff;
  color: #375c7c;
  font-weight: 700;
}

.calendar-day {
  border: 1px solid #d8e9f8;
  background: #fff;
  cursor: pointer;
}

.calendar-day.outside {
  opacity: 0.4;
}

.calendar-day.pending {
  background: #ffe58f;
  border-color: #f4ce55;
}

.calendar-day.selected {
  outline: 2px solid #2f6f9f;
  outline-offset: -1px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  max-width: min(520px, 90vw);
  background: #1b3f5d;
  color: #eaf6ff;
  border-radius: 10px;
  padding: 11px 13px;
  box-shadow: 0 14px 22px rgba(10, 32, 52, 0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 19, 31, 0.18);
  display: grid;
  place-items: center;
  z-index: 70;
  pointer-events: none;
}

.busy-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(22, 70, 107, 0.28);
  border-top-color: #2f6f9f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.print-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 24, 40, 0.58);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 14px;
}

.print-modal-card {
  width: min(1180px, 98vw);
  height: min(92vh, 920px);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #b9d4e9;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.print-modal-head {
  padding: 10px 12px;
  border-bottom: 1px solid #d6e8f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f4faff;
}

.print-modal-head h3 {
  margin: 0;
  color: #204d71;
}

.print-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.compliance-panel {
  margin-top: 14px;
  border: 1px solid #bcd7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

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

.compliance-panel-head h3 {
  margin: 0 0 4px;
  color: #204d71;
}

.compliance-panel-head p {
  margin: 0;
  color: #54708a;
}

.compliance-toggle {
  flex: 0 0 auto;
  min-width: 146px;
  justify-content: center;
}

.compliance-toggle span:first-child {
  display: inline-block;
  width: 16px;
  font-size: 18px;
  line-height: 1;
}

.compliance-compact-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: center;
}

.compliance-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #cfe2f3;
  border-radius: 999px;
  padding: 3px 9px;
  background: #fff;
  color: #2f5676;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.compliance-chip.ok {
  border-color: #a9dec2;
  background: #f1fff7;
  color: #22643d;
}

.compliance-chip.warn {
  border-color: #efd083;
  background: #fff9e6;
  color: #785a12;
}

.compliance-chip.error {
  border-color: #efb1a2;
  background: #fff2ee;
  color: #8a2f14;
}

.compliance-chip.muted {
  border-color: #d6e4ef;
  background: #f7fbfe;
  color: #607a91;
}

.compliance-details {
  margin-top: 10px;
}

.compliance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: start;
}

.compliance-sections {
  display: grid;
  gap: 10px;
}

.compliance-card {
  border: 1px solid #d4e6f5;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

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

.compliance-card-head h4 {
  margin: 0;
  color: #1f4d70;
  font-size: 15px;
}

.compliance-summary p {
  margin: 5px 0;
}

.compliance-summary .muted {
  color: #607a91;
  font-size: 12px;
}

.certificate-upload {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.certificate-upload input[type="file"],
.certificate-upload input[type="password"] {
  width: 100%;
}

.compliance-readiness {
  border: 1px solid #d4e6f5;
  border-radius: 8px;
  background: #f8fbfe;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.compliance-readiness h5 {
  margin: 0 0 6px;
  color: #1f4d70;
  font-size: 13px;
}

.compliance-readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px 12px;
}

.compliance-readiness p {
  margin: 3px 0;
}

.compliance-grid p {
  margin: 5px 0;
}

.compliance-grid code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.compliance-qr-box {
  min-height: 132px;
  border: 1px dashed #bcd7eb;
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 8px;
}

.compliance-qr-box img {
  width: 116px;
  height: 116px;
  object-fit: contain;
}

.compliance-errors {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #f4b7a7;
  border-radius: 8px;
  background: #fff4ef;
  color: #8a2f14;
  font-size: 12px;
}

.compliance-audit {
  margin-top: 10px;
}

.compliance-audit ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

@media (max-width: 760px) {
  .compliance-panel-head,
  .compliance-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .compliance-toggle {
    width: 100%;
  }

  .compliance-grid {
    grid-template-columns: 1fr;
  }
}

.message-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 42, 0.44);
  display: grid;
  place-items: start center;
  z-index: 95;
  padding: 12px;
  overflow: auto;
}

.message-card {
  width: min(520px, 96vw);
  background: #fff;
  border: 1px solid #bcd7eb;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(12, 33, 54, 0.24);
  padding: 16px;
}

.message-card h3 {
  margin: 0;
  color: #1f4d70;
}

.message-card p {
  margin: 0 0 10px;
  color: #3f5f7a;
}

#messageModalText {
  margin: 0 0 10px;
  color: #3f5f7a;
}

.message-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

#messageModalIcon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.message-card .row-actions {
  justify-content: flex-end;
}

.message-card.success {
  border-color: #8cd8af;
}

.message-card.warning {
  border-color: #f2ca69;
}

.message-card.error {
  border-color: #e4a2a2;
}

.message-card.support {
  width: min(760px, 96vw);
}

.support-modal-content {
  display: grid;
  gap: 10px;
}

.support-modal-section {
  background: #f5fbff;
  border: 1px solid #d3e6f5;
  border-radius: 10px;
  padding: 10px 12px;
}

.support-modal-section p {
  margin: 0 0 6px;
  color: #355878;
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f5f95;
  font-weight: 800;
  text-decoration: none;
}

.support-link:hover {
  text-decoration: underline;
}

.support-link img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.nominas-access-card {
  width: min(620px, 96vw);
}

.nominas-access-modal {
  display: grid;
  gap: 10px;
}

.nominas-access-text {
  margin: 0;
  color: #355878;
}

.nominas-access-tip {
  margin: 0;
  color: #446584;
  font-size: 0.82rem;
}

.nominas-password-input {
  border-width: 2px;
}

.nominas-password-input.invalid {
  border-color: #d54f4f;
}

.nominas-password-input.valid {
  border-color: #4ab86a;
}

.nominas-password-rules {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: #6a3f3f;
  font-size: 0.8rem;
}

.nominas-password-rules li.valid {
  color: #1f6f42;
}

.nomina-editor-card {
  width: min(1560px, 99vw);
}

.message-card.nomina-editor-card #messageModalActions {
  display: none;
}

.nomina-editor-shell {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: visible;
}

.nomina-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  padding: 0 0 6px;
  border-bottom: 1px solid #d8e7f4;
}

.nomina-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.nomina-editor-grid .full {
  grid-column: 1 / -1;
}

.nomina-totals {
  display: grid;
  gap: 4px;
  border: 1px solid #cfe3f4;
  border-radius: 10px;
  background: #f5fbff;
  padding: 10px;
}

.nomina-totals p {
  margin: 0;
  color: #1f4f74;
}

.nomina-history-card {
  width: min(1260px, 99vw);
}

.nomina-history-shell {
  display: grid;
  gap: 10px;
}

.nomina-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nomina-history-toolbar .btn {
  min-width: 146px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nomina-history-toolbar label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2f5679;
}

.nomina-history-table-wrap {
  max-height: 52vh;
  overflow: auto;
  border: 1px solid #cfe3f4;
  border-radius: 10px;
  background: #fff;
}

.nomina-history-table {
  width: 100%;
  border-collapse: collapse;
}

.nomina-history-table th,
.nomina-history-table td {
  border-bottom: 1px solid #e2eef8;
  padding: 7px 8px;
  font-size: 0.77rem;
  text-align: left;
}

.nomina-history-table th:first-child,
.nomina-history-table td:first-child {
  width: 52px;
  text-align: center;
  padding-inline: 4px;
}

.nomina-history-table th {
  background: #f5fbff;
  color: #2a5276;
  position: sticky;
  top: 0;
  z-index: 1;
}

.nomina-history-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nomina-history-actions .action-btn {
  min-width: 88px;
  justify-content: center;
  margin-right: 0;
}

.nomina-history-check {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  display: block;
}

.nomina-history-empty {
  margin: 0;
  color: #4a6783;
  font-size: 0.82rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes fadeUpIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1220px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-modules-status-list {
    grid-template-columns: 1fr;
  }

  .agenda-shell {
    grid-template-columns: 1fr;
  }

  #agendaForm.agenda-editor {
    grid-template-columns: 1fr;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid.dashboard-bottom {
    grid-template-columns: 1fr;
  }

  .nomina-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .shell {
    width: calc(100% - 20px);
    margin: 10px 10px 16px;
    grid-template-columns: 1fr;
    transition: none;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    height: auto;
    max-height: none;
    position: static;
    transition: none;
  }

  .sidebar:hover {
    width: 100%;
  }

  .sidebar-title span,
  .module-link span,
  .sidebar:hover .sidebar-title span,
  .sidebar:hover .module-link span {
    opacity: 1;
    width: auto;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-separator {
    grid-column: 1 / -1;
  }

  .module-link {
    justify-content: flex-start;
  }

  .sidebar-version {
    display: none;
  }
}

@media (hover: none) {
  .module-link:hover {
    transform: none;
  }
}

@media (max-width: 900px) {
  .table-wrap {
    overflow-x: hidden;
    border: none;
    background: transparent;
  }

  .table-wrap.slim {
    max-height: none;
  }

  .table-wrap > table {
    display: block;
    table-layout: auto;
    min-width: 0;
    width: 100%;
  }

  .table-wrap > table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table-wrap > table tbody {
    display: grid;
    gap: 10px;
  }

  .table-wrap > table tr {
    display: block;
    border: 1px solid #d3e6f5;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
  }

  .table-wrap > table td {
    display: grid;
    grid-template-columns: minmax(110px, 44%) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid #edf4fb;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
  }

  .table-wrap > table td:last-child {
    border-bottom: none;
  }

  .table-wrap > table td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    line-height: 1.2;
    font-weight: 800;
    color: #416486;
    letter-spacing: 0.22px;
    text-transform: uppercase;
  }

  .table-wrap > table td.selection-cell {
    grid-template-columns: minmax(110px, 44%) auto;
    align-items: center;
  }

  .table-wrap > table td.selection-cell .row-select {
    width: 20px;
    height: 20px;
    margin: 0;
  }

  .table-wrap > table td.actions-cell {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .table-wrap > table td.actions-cell::before {
    margin-bottom: 2px;
  }

  .table-wrap > table td.actions-cell > * {
    justify-self: start;
  }

  .grid-2,
  .stats {
    grid-template-columns: 1fr;
  }

  .home-modules-status-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 12px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-title {
    justify-content: center;
  }

  .sidebar-title span,
  .module-link span {
    display: none;
  }

  .module-link {
    justify-content: center;
    padding: 8px 6px;
    min-height: 42px;
  }

  .workspace .card {
    padding: 12px;
  }

  th,
  td {
    font-size: 0.74rem;
    padding: 6px 6px;
  }

  .action-btn {
    padding: 4px 7px;
    font-size: 0.72rem;
    margin-right: 2px;
    white-space: nowrap;
  }

  .nomina-editor-grid {
    grid-template-columns: 1fr;
  }

  .nomina-editor-shell {
    max-height: min(74vh, 680px);
  }

  .nomina-history-toolbar .btn {
    min-width: 0;
    flex: 1 1 140px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 12px);
    margin: 6px 6px 12px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 7px;
  }

  .module-link {
    min-height: 38px;
    padding: 5px 4px;
    border-radius: 10px;
  }

  .module-link img {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .workspace .card {
    padding: 10px;
  }

  .module-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .rectify-notice {
    flex-direction: column;
    align-items: flex-start;
  }
}
