/* TECNI RENT — Aptos Display en todo el dashboard */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap");

:root {
  --azul-industrial: #0070b5;
  --naranja-maquinaria: #ea7f26;
  --verde-seguridad: #64ae27;
  --amarillo-operativo: #e6dd15;
  --azul-corporativo: #4f81bd;
  --gris-antracita: #373333;
  --plata-industrial: #e3e2de;
  --blanco: #ffffff;

  --ink: #2c2928;
  --muted: #6f6a67;
  --paper: #f4f3f0;
  --panel: #ffffff;
  --line: #d8d5d0;
  --line-strong: #c5c1ba;
  --soft: #f7f6f4;
  --shadow: 0 1px 2px rgba(55, 51, 51, 0.04), 0 12px 28px rgba(55, 51, 51, 0.07);
  --shadow-hover: 0 4px 8px rgba(55, 51, 51, 0.06), 0 18px 36px rgba(55, 51, 51, 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --space: 8px;

  /* Aptos Display en Windows; Outfit como fallback web */
  --font-display: "Aptos Display", "Aptos", "Outfit", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: "Aptos Display", "Aptos", "Outfit", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(1000px 420px at 0% -10%, rgba(0, 112, 181, 0.09), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(234, 127, 38, 0.07), transparent 50%),
    linear-gradient(180deg, #f7f6f3 0%, var(--paper) 40%, #ebe9e4 100%);
  min-height: 100vh;
}

button, select, input, textarea, label, table, th, td, .btn, .form-control, .form-select {
  font-family: var(--font-body) !important;
}

/* ——— Brand ——— */
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--azul-industrial);
  line-height: 1;
}

.brand-mark span { color: var(--naranja-maquinaria); }

.brand-tag {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ——— Nav ——— */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.app-nav::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--azul-industrial) 0 68%, var(--naranja-maquinaria) 68% 100%);
}

.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.fresh { color: #3f7a18; background: rgba(100, 174, 39, 0.1); border-color: rgba(100, 174, 39, 0.28); }
.status-pill.stale { color: #a55a12; background: rgba(234, 127, 38, 0.12); border-color: rgba(234, 127, 38, 0.3); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.user-chip {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0.42rem 0.75rem;
  background: var(--plata-industrial);
  border-radius: var(--radius-sm);
}

.btn-ghost,
.btn-solid,
.btn-text {
  appearance: none;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  height: 36px;
  padding: 0 0.9rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--azul-industrial);
  color: var(--azul-industrial);
}

.btn-ghost:hover {
  background: var(--azul-industrial);
  color: var(--blanco);
}

.btn-ghost.is-active {
  background: var(--azul-industrial);
  color: var(--blanco);
}

.btn-solid {
  background: var(--gris-antracita);
  border: 1px solid var(--gris-antracita);
  color: var(--blanco);
}

.btn-solid:hover {
  background: #241f1f;
  color: var(--blanco);
}

.btn-text {
  height: auto;
  padding: 0.2rem 0.35rem;
  background: transparent;
  border: none;
  color: var(--azul-industrial);
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-text:hover { color: var(--naranja-maquinaria); text-decoration: underline; }

/* ——— Main layout ——— */
.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) minmax(320px, 0.9fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.page-head-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 0.25rem 0;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--naranja-maquinaria);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 750;
  font-size: clamp(1.85rem, 2.4vw, 2.45rem);
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--gris-antracita);
  text-transform: none;
}

.meta-line {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.block { margin-bottom: 1.75rem; }
.block-last { margin-bottom: 0; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--gris-antracita);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title::before {
  content: "";
  width: 3px;
  height: 1em;
  background: var(--naranja-maquinaria);
  border-radius: 2px;
  flex-shrink: 0;
}

.block-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ——— Filters / dropdowns ——— */
.filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.filter-panel-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gris-antracita);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.select-wrap {
  position: relative;
  width: 100%;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--azul-industrial);
  border-bottom: 2px solid var(--azul-industrial);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.field-select {
  width: 100%;
  height: 44px;
  padding: 0 2.4rem 0 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 550;
  line-height: 1.2;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-select:hover {
  border-color: var(--azul-corporativo);
  background: var(--blanco);
}

.field-select:focus {
  outline: none;
  border-color: var(--azul-industrial);
  background: var(--blanco);
  box-shadow: 0 0 0 3px rgba(0, 112, 181, 0.16);
}

.field-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ——— KPIs ——— */
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 4px solid var(--azul-industrial);
  padding: 1.15rem 1.2rem 1.2rem;
  box-shadow: var(--shadow);
  height: 100%;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -24px auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(0, 112, 181, 0.07);
  pointer-events: none;
}

#kpi-row > [class*="col-"]:nth-child(4n + 1) .kpi-card { border-left-color: var(--azul-industrial); }
#kpi-row > [class*="col-"]:nth-child(4n + 2) .kpi-card { border-left-color: var(--naranja-maquinaria); }
#kpi-row > [class*="col-"]:nth-child(4n + 3) .kpi-card { border-left-color: var(--verde-seguridad); }
#kpi-row > [class*="col-"]:nth-child(4n + 4) .kpi-card { border-left-color: var(--azul-corporativo); }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.kpi-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2vw, 1.95rem);
  font-weight: 750;
  line-height: 1.05;
  color: var(--gris-antracita);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* ——— Charts & table ——— */
.chart-panel,
.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow);
}

.chart-brush-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 112, 181, 0.1);
  border: 1px solid rgba(0, 112, 181, 0.28);
  color: var(--azul-industrial);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-display);
}

.chart-brush-chip[hidden] { display: none !important; }

.chart-brush-chip strong {
  color: var(--gris-antracita);
}

.chart-panel {
  position: relative;
  min-height: 390px;
}

.table-shell {
  padding: 1.15rem 1.15rem 1rem;
  overflow: visible;
}

.table-shell .dataTables_wrapper {
  width: 100%;
}

.table-shell .dataTables_scroll {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--blanco);
}

.table-shell .dataTables_scrollHead {
  overflow: hidden !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.table-shell .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-gutter: stable;
}

.table-shell .dataTables_scrollBody::-webkit-scrollbar {
  height: 10px;
}

.table-shell .dataTables_scrollBody::-webkit-scrollbar-thumb {
  background: var(--azul-corporativo);
  border-radius: 999px;
}

.table-shell .dataTables_scrollBody::-webkit-scrollbar-track {
  background: var(--plata-industrial);
}

.table-scroll-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
}

.table-shell .dataTables_wrapper .dataTables_length,
.table-shell .dataTables_wrapper .dataTables_filter {
  margin-bottom: 0.85rem;
}

.table-shell .dataTables_wrapper .dataTables_filter input,
.table-shell .dataTables_wrapper .dataTables_length select {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 0.65rem;
  background: var(--soft);
  color: var(--ink);
}

.table-shell .dataTables_wrapper .dataTables_length select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.8rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--azul-industrial) 50%),
    linear-gradient(135deg, var(--azul-industrial) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.table-shell .dataTables_wrapper .dataTables_filter input:focus,
.table-shell .dataTables_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: var(--azul-industrial);
  box-shadow: 0 0 0 3px rgba(0, 112, 181, 0.14);
  background-color: var(--blanco);
}

.table-shell .dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
}

.table-shell .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--azul-industrial) !important;
  border-color: var(--azul-industrial) !important;
  color: #fff !important;
}

.table-shell table.dataTable thead th {
  background: var(--azul-industrial);
  color: var(--blanco);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: none !important;
  white-space: nowrap;
  padding: 0.75rem 0.85rem !important;
}

.table-shell table.dataTable tbody tr:nth-child(even) {
  background: rgba(227, 226, 222, 0.4);
}

.table-shell table.dataTable tbody td {
  font-size: 0.88rem;
  vertical-align: middle;
  padding: 0.65rem 0.85rem !important;
}

.table-shell table.dataTable.table-hover > tbody > tr:hover > * {
  background-color: rgba(0, 112, 181, 0.07);
}

.num-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 550;
}

.badge-estado {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-estado.is-revisada {
  background: rgba(100, 174, 39, 0.14);
  color: #3f7a18;
}

.badge-estado.is-pendiente {
  background: rgba(234, 127, 38, 0.14);
  color: #a55a12;
}

/* ——— Login ——— */
.login-body {
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(0, 112, 181, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 100%, rgba(234, 127, 38, 0.12), transparent 50%),
    linear-gradient(160deg, #f7f6f3 0%, var(--plata-industrial) 100%);
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--azul-industrial);
  border-radius: var(--radius);
  padding: 2.35rem 1.9rem;
  box-shadow: var(--shadow);
  position: relative;
}

.login-panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 78px;
  height: 4px;
  background: var(--naranja-maquinaria);
}

.login-panel .form-label {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.login-panel .form-control {
  height: 48px;
  border-radius: var(--radius-sm);
  border-color: var(--line-strong);
  background: var(--soft);
  font-size: 1rem;
}

.login-panel .form-control:focus {
  border-color: var(--azul-industrial);
  background: var(--blanco);
  box-shadow: 0 0 0 3px rgba(0, 112, 181, 0.16);
}

.login-panel .btn-primary {
  height: 48px;
  background: var(--azul-industrial);
  border-color: var(--azul-industrial);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 1.05rem;
}

.login-panel .btn-primary:hover,
.login-panel .btn-primary:focus {
  background: #005a92;
  border-color: #005a92;
}

.login-sub {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ——— Motion ——— */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.kpi-card, .chart-panel, .table-shell, .filter-panel {
  animation: fadeUp 0.4s ease both;
}

.charts-row > [class*="col-"]:nth-child(2) .chart-panel { animation-delay: 0.05s; }
.charts-row > [class*="col-"]:nth-child(3) .chart-panel { animation-delay: 0.1s; }
.charts-row > [class*="col-"]:nth-child(4) .chart-panel { animation-delay: 0.15s; }

.status-pill.stale .status-dot { animation: pulseSoft 1s ease infinite; }

/* ——— Responsive ——— */
@media (max-width: 991px) {
  .page-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-inner, .app-main { padding-left: 1rem; padding-right: 1rem; }
  .filter-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.7rem; }
  .kpi-value { font-size: 1.45rem; }
  .nav-actions { width: 100%; }
}
