/* =========================================================
   CASONA DECO · BODEGA
   DASHBOARD V2
========================================================= */

:root {
  /* Base */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f1f5f9;

  /* Líneas */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Texto */
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;

  /* Header */
  --header: #111827;
  --header-soft: #1f2937;

  /* Marca / acción */
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;

  /* Estados */
  --pending: #64748b;
  --pending-soft: #f1f5f9;

  --warehouse: #f59e0b;
  --warehouse-soft: #fff7ed;

  --building: #7c3aed;
  --building-soft: #f5f3ff;

  --dispatch: #0ea5a4;
  --dispatch-soft: #ecfeff;

  --success: #16a34a;
  --success-soft: #f0fdf4;

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: #fef2f2;

  /* Zonas */
  --santiago: #2563eb;
  --santiago-soft: #eff6ff;

  --regiones: #7c3aed;
  --regiones-soft: #f5f3ff;

  /* Otros */
  --shadow-xs:
    0 1px 2px rgba(15, 23, 42, 0.04);

  --shadow-sm:
    0 2px 8px rgba(15, 23, 42, 0.06);

  --shadow-md:
    0 8px 24px rgba(15, 23, 42, 0.08);

  --shadow-lg:
    0 24px 60px rgba(15, 23, 42, 0.18);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 220px;
  --topbar-height: 76px;
}


/* =========================================================
   RESET
========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--bg);
  color: var(--text);

  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}


/* =========================================================
   TOPBAR
========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;

  height: var(--topbar-height);

  background:
    linear-gradient(
      135deg,
      #111827 0%,
      #172033 100%
    );

  border-bottom:
    1px solid rgba(255, 255, 255, 0.06);

  box-shadow:
    0 2px 12px rgba(15, 23, 42, 0.12);
}

.topbar-inner {
  width: 100%;
  height: 100%;

  padding: 0 26px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}


/* =========================================================
   BRAND
========================================================= */

.brand {
  display: flex;
  align-items: center;
  gap: 13px;

  min-width: 220px;
}

.brand-mark {
  width: 45px;
  height: 45px;

  flex: 0 0 45px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background:
    linear-gradient(
      135deg,
      #2563eb,
      #4f46e5
    );

  color: #ffffff;

  font-size: 13px;
  font-weight: 900;

  letter-spacing: 0.04em;

  box-shadow:
    0 8px 18px rgba(37, 99, 235, 0.28);
}

.brand-copy h1 {
  margin: 0;

  color: #ffffff;

  font-size: 17px;
  font-weight: 800;

  line-height: 1.15;
}

.brand-copy p {
  margin: 4px 0 0;

  color: #cbd5e1;

  font-size: 12px;
  font-weight: 500;
}


/* =========================================================
   TOPBAR RIGHT
========================================================= */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-icon-button {
  position: relative;

  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.06);
  color: white;

  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.topbar-icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.topbar-icon {
  font-weight: 900;
}

.notification-count {
  position: absolute;

  top: -5px;
  right: -5px;

  min-width: 18px;
  height: 18px;

  padding: 0 5px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  background: var(--danger);
  color: white;

  font-size: 10px;
  font-weight: 900;
}

.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background:
    linear-gradient(
      135deg,
      #2563eb,
      #4f46e5
    );

  color: white;

  font-size: 12px;
  font-weight: 900;
}

.user-copy {
  display: flex;
  flex-direction: column;
}

.user-copy strong {
  color: white;

  font-size: 13px;
  font-weight: 700;
}

.user-copy span {
  margin-top: 2px;

  color: #94a3b8;

  font-size: 11px;
}


/* =========================================================
   APP
========================================================= */

.app-shell {
  min-height:
    calc(100vh - var(--topbar-height));

  display: flex;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
  position: sticky;
  top: var(--topbar-height);

  width: var(--sidebar-width);
  height:
    calc(100vh - var(--topbar-height));

  flex: 0 0 var(--sidebar-width);

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  padding: 24px 14px 18px;

  background: var(--surface);

  border-right: 1px solid var(--border);
}

.sidebar-nav {
  display: grid;
  gap: 7px;
}

.sidebar-item,
.sidebar-logout {
  width: 100%;

  display: flex;
  align-items: center;
  gap: 11px;

  border: 0;
  border-radius: 10px;

  background: transparent;

  color: var(--text-soft);

  padding: 11px 12px;

  text-align: left;

  font-size: 13px;
  font-weight: 600;

  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.sidebar-item:hover,
.sidebar-logout:hover {
  background: var(--surface-hover);
}

.sidebar-item.active {
  background: var(--brand-soft);
  color: var(--brand);

  font-weight: 800;
}

.sidebar-icon {
  width: 22px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 15px;
  font-weight: 900;
}

.sidebar-badge {
  margin-left: auto;

  min-width: 20px;
  height: 20px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  background: var(--danger);
  color: white;

  font-size: 10px;
  font-weight: 900;
}

.sidebar-footer {
  padding-top: 18px;

  border-top: 1px solid var(--border);
}

.sidebar-logout {
  color: var(--muted);
}


/* =========================================================
   MAIN
========================================================= */

.main-container {
  min-width: 0;
  width:
    calc(100% - var(--sidebar-width));

  padding: 30px 32px 70px;
}


/* =========================================================
   PAGE HEADING
========================================================= */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;

  margin-bottom: 24px;
}

.page-kicker,
.section-kicker {
  display: block;

  margin-bottom: 6px;

  color: var(--brand);

  font-size: 10px;
  font-weight: 900;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-heading h2 {
  margin: 0;

  color: var(--text);

  font-size: 31px;
  font-weight: 850;

  letter-spacing: -0.035em;
}

.page-heading p {
  margin: 7px 0 0;

  color: var(--muted);

  font-size: 13px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* =========================================================
   SEARCH
========================================================= */

.header-search {
  position: relative;

  width: min(360px, 35vw);
}

.header-search-icon {
  position: absolute;

  left: 13px;
  top: 50%;

  transform: translateY(-50%);

  color: var(--muted);

  font-size: 17px;

  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 43px;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: var(--surface);

  color: var(--text);

  outline: none;

  padding:
    10px
    13px
    10px
    39px;

  font-size: 13px;

  box-shadow: var(--shadow-xs);

  transition:
    border 0.15s ease,
    box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--muted-light);
}

.search-input:focus {
  border-color: #93c5fd;

  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.08);
}


/* =========================================================
   BUTTONS
========================================================= */

.button {
  min-height: 43px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 0;
  border-radius: 10px;

  padding: 10px 16px;

  font-size: 12px;
  font-weight: 800;

  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background:
    linear-gradient(
      135deg,
      #2563eb,
      #315efb
    );

  color: white;

  box-shadow:
    0 7px 15px rgba(37, 99, 235, 0.2);
}

.button-primary:hover {
  background: var(--brand-hover);
}

.button-secondary {
  border: 1px solid var(--border);

  background: var(--surface);

  color: var(--text-soft);
}

.button-secondary:hover {
  background: var(--surface-hover);
}

.button-problem {
  border: 1px solid #fecaca;

  background: var(--danger-soft);

  color: var(--danger);
}

.button-problem:hover {
  background: #fee2e2;
}


/* =========================================================
   STATS
========================================================= */

.stats-grid {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 14px;

  margin-bottom: 20px;
}

.stat-card {
  position: relative;

  min-height: 126px;

  display: flex;
  align-items: flex-start;
  gap: 15px;

  overflow: hidden;

  padding: 19px;

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  background: var(--surface);

  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  height: 4px;
}

.stat-pending::before {
  background: var(--pending);
}

.stat-warehouse::before {
  background: var(--warehouse);
}

.stat-building::before {
  background: var(--building);
}

.stat-shipped::before {
  background: var(--success);
}

.stat-icon {
  width: 38px;
  height: 38px;

  flex: 0 0 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  font-size: 16px;
  font-weight: 900;
}

.stat-pending .stat-icon {
  background: var(--pending-soft);
  color: var(--pending);
}

.stat-warehouse .stat-icon {
  background: var(--warehouse-soft);
  color: var(--warehouse);
}

.stat-building .stat-icon {
  background: var(--building-soft);
  color: var(--building);
}

.stat-shipped .stat-icon {
  background: var(--success-soft);
  color: var(--success);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-number {
  color: var(--text);

  font-size: 29px;
  font-weight: 900;

  line-height: 1;
}

.stat-label {
  margin-top: 9px;

  color: var(--text);

  font-size: 13px;
  font-weight: 800;
}

.stat-helper {
  margin-top: 4px;

  color: var(--muted);

  font-size: 11px;
}


/* =========================================================
   FILTERS
========================================================= */

.filters-panel {
  margin-bottom: 24px;

  padding: 12px 14px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--surface);

  box-shadow: var(--shadow-xs);
}

.filters-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.filter-buttons,
.status-filters {
  display: flex;
  align-items: center;
  gap: 8px;

  flex-wrap: wrap;
}

.filter-button,
.status-filter {
  min-height: 37px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface);

  color: var(--text-soft);

  padding: 7px 12px;

  font-size: 11px;
  font-weight: 750;

  transition:
    background 0.15s ease,
    border 0.15s ease,
    color 0.15s ease;
}

.filter-button:hover,
.status-filter:hover {
  background: var(--surface-hover);
}

.filter-button.active,
.status-filter.active {
  border-color: #bfdbfe;

  background: var(--brand-soft);

  color: var(--brand);
}

.filter-problem {
  color: var(--danger);
}

.filter-problem.active {
  border-color: #fecaca;

  background: var(--danger-soft);

  color: var(--danger);
}

.filter-icon {
  font-size: 11px;
}

.status-filters {
  margin-top: 12px;

  padding-top: 12px;

  border-top: 1px solid var(--border);
}


/* =========================================================
   ORDERS SECTION
========================================================= */

.orders-section {
  min-width: 0;
}

.orders-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  margin-bottom: 12px;
}

.orders-heading h3 {
  margin: 0;

  font-size: 16px;
  font-weight: 800;
}

.orders-heading p {
  margin: 4px 0 0;

  color: var(--muted);

  font-size: 11px;
}


/* =========================================================
   ORDERS GRID / LIST
========================================================= */

.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.order-card {
  position: relative;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--surface);

  box-shadow: var(--shadow-xs);

  cursor: pointer;

   

  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.order-card:active {
  transform: scale(0.995);
}

.order-card::before {
  content: "";

  position: absolute;

  left: 0;
  top: 0;
  bottom: 0;

  width: 4px;

  background: var(--border-strong);
}

.order-card:hover {
  transform: translateY(-1px);

  border-color: #cbd5e1;

  box-shadow: var(--shadow-md);
}

.order-card-inner {
  min-height: 112px;

  display: grid;

  grid-template-columns:
    minmax(180px, 0.8fr)
    minmax(240px, 1.4fr)
    minmax(180px, 0.7fr);

  align-items: center;
  gap: 20px;

  padding: 17px 20px 17px 23px;
}


/* =========================================================
   ORDER TOP
========================================================= */

.order-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-number {
  margin: 0;

  color: var(--text);

  font-size: 20px;
  font-weight: 900;

  letter-spacing: -0.025em;
}

.order-date {
  margin: 7px 0 0;

  color: var(--muted);

  font-size: 11px;
}


/* =========================================================
   ZONE BADGES
========================================================= */

.zone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: fit-content;

  border-radius: 999px;

  padding: 5px 9px;

  font-size: 9px;
  font-weight: 900;

  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.zone-santiago {
  border: 1px solid #bfdbfe;

  background: var(--santiago-soft);

  color: var(--santiago);
}

.zone-regiones {
  border: 1px solid #ddd6fe;

  background: var(--regiones-soft);

  color: var(--regiones);
}


/* =========================================================
   ORDER PRODUCTS PREVIEW
========================================================= */

.order-card-products {
  display: flex;
  align-items: center;
  gap: 14px;

  margin: 0;
}

.order-thumb-group {
  display: flex;
  align-items: center;
}

.order-thumb {
  width: 54px;
  height: 54px;

  flex: 0 0 54px;

  object-fit: cover;

  border: 2px solid white;
  border-radius: 10px;

  margin-left: -8px;

  background: #f1f5f9;

  box-shadow: var(--shadow-xs);
}

.order-thumb:first-child {
  margin-left: 0;
}

.order-product-summary {
  color: var(--text-soft);

  font-size: 12px;
  font-weight: 600;

  line-height: 1.5;
}


/* =========================================================
   ORDER STATUS
========================================================= */

.order-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  padding: 0;

  border-top: 0;
}

.status-badge {
  min-height: 30px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  border-radius: 999px;

  padding: 6px 11px;

  font-size: 10px;
  font-weight: 900;

  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;
}


/* Pendiente */

.status-pendiente {
  background: var(--pending-soft);
  color: var(--pending);
}

.status-pendiente .status-dot {
  background: var(--pending);
}


/* Bodega */

.status-bodega {
  background: var(--warehouse-soft);
  color: #c46a07;
}

.status-bodega .status-dot {
  background: var(--warehouse);
}


/* Armando */

.status-armando {
  background: var(--building-soft);
  color: var(--building);
}

.status-armando .status-dot {
  background: var(--building);
}


/* Enviado */

.status-enviado {
  background: var(--success-soft);
  color: var(--success);
}

.status-enviado .status-dot {
  background: var(--success);
}


/* Problema */

.status-problema {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-problema .status-dot {
  background: var(--danger);
}


/* =========================================================
   VIEW ORDER
========================================================= */

.order-view-button {
  min-height: 35px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface);

  color: var(--text-soft);

  padding: 7px 11px;

  font-size: 10px;
  font-weight: 800;

  transition:
    background 0.15s ease,
    border 0.15s ease,
    color 0.15s ease;
}

.order-view-button:hover {
  border-color: #bfdbfe;

  background: var(--brand-soft);

  color: var(--brand);
}


/* =========================================================
   EMPTY STATE
========================================================= */

.empty-state {
  min-height: 300px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;

  color: var(--muted);
}

.empty-icon {
  width: 56px;
  height: 56px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 16px;

  background: var(--surface);

  color: var(--brand);

  box-shadow: var(--shadow-sm);

  font-size: 22px;
}

.empty-state h3 {
  margin: 15px 0 6px;

  color: var(--text);

  font-size: 16px;
}

.empty-state p {
  margin: 0;

  font-size: 12px;
}


/* =========================================================
   MODAL OVERLAY
========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;

  z-index: 100;

  display: flex;
  align-items: stretch;
  justify-content: flex-end;

  background: rgba(15, 23, 42, 0.38);

  backdrop-filter: blur(2px);
}


/* =========================================================
   MODAL DRAWER
========================================================= */

.modal {
  width: min(610px, 100%);
  height: 100vh;

  overflow-y: auto;
  overflow-x: hidden;

  background: var(--surface);

  border-left: 1px solid var(--border);

  box-shadow:
    -20px 0 60px rgba(15, 23, 42, 0.18);

  animation:
    slideDrawer 0.2s ease;
}

@keyframes slideDrawer {
  from {
    transform: translateX(30px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* =========================================================
   MODAL HEADER
========================================================= */

.modal-header {
  position: sticky;
  top: 0;

  z-index: 4;

  display: flex;
  justify-content: space-between;
  gap: 20px;

  padding: 22px 24px;

  border-bottom: 1px solid var(--border);

  background:
    rgba(255, 255, 255, 0.96);

  backdrop-filter: blur(14px);
}

.modal-heading {
  min-width: 0;
}

.back-button {
  border: 0;

  background: transparent;

  color: var(--muted);

  padding: 0;

  font-size: 11px;
  font-weight: 700;
}

.back-button:hover {
  color: var(--brand);
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-top: 12px;
}

.modal-title-row h2 {
  margin: 0;

  color: var(--text);

  font-size: 26px;
  font-weight: 900;

  letter-spacing: -0.03em;
}

.modal-date {
  margin: 7px 0 0;

  color: var(--muted);

  font-size: 11px;

  line-height: 1.5;
}

.modal-close {
  width: 37px;
  height: 37px;

  flex: 0 0 37px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 10px;

  background: var(--surface);

  color: var(--text-soft);

  font-size: 23px;
  line-height: 1;

  transition:
    background 0.15s ease;
}

.modal-close:hover {
  background: var(--surface-hover);
}


/* =========================================================
   MODAL CONTENT
========================================================= */

.modal-content {
  padding: 23px 24px 100px;
}

.modal-content section + section {
  margin-top: 29px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;

  margin-bottom: 13px;
}

.section-heading h3 {
  margin: 0;

  color: var(--text);

  font-size: 15px;
  font-weight: 850;
}

.section-kicker {
  margin-bottom: 4px;

  font-size: 9px;
}


/* =========================================================
   PROGRESS
========================================================= */

.progress-steps {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 8px;

  margin-top: 13px;
}

.progress-step {
  position: relative;

  min-height: 82px;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: var(--surface-soft);

  padding: 11px;

  transition:
    background 0.15s ease,
    border 0.15s ease;
}

.progress-step.completed {
  border-color: #bbf7d0;

  background: var(--success-soft);
}

.progress-step.current {
  border-color: #c4b5fd;

  background: var(--building-soft);
}

.progress-step-number {
  width: 25px;
  height: 25px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #e2e8f0;

  color: var(--muted);

  font-size: 10px;
  font-weight: 900;
}

.progress-step.completed
.progress-step-number {
  background: var(--success);
  color: white;
}

.progress-step.current
.progress-step-number {
  background: var(--building);
  color: white;
}

.progress-step-label {
  display: block;

  margin-top: 8px;

  color: var(--text-soft);

  font-size: 10px;
  font-weight: 800;

  line-height: 1.35;
}


/* =========================================================
   PRODUCT COUNT
========================================================= */

.product-count {
  border-radius: 999px;

  background: var(--surface-soft);

  color: var(--muted);

  padding: 5px 9px;

  font-size: 10px;
  font-weight: 700;
}


/* =========================================================
   PRODUCTS
========================================================= */

.product-list {
  display: grid;
  gap: 9px;
}

.product-item {
  display: grid;

  grid-template-columns:
    82px
    minmax(0, 1fr);

  gap: 14px;

  align-items: center;

  padding: 10px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: var(--surface);

  box-shadow: var(--shadow-xs);

  transition:
    border 0.15s ease,
    box-shadow 0.15s ease;
}

.product-item:hover {
  border-color: #cbd5e1;

  box-shadow: var(--shadow-sm);
}

.product-image-wrapper {
  width: 82px;
  height: 82px;

  flex: 0 0 82px;

  overflow: hidden;

  border: 0;
  border-radius: 10px;

  background: #f1f5f9;

  padding: 0;

  cursor: zoom-in;
}

.product-image {
  width: 100%;
  height: 100%;

  object-fit: cover;

  transition:
    transform 0.2s ease;
}

.product-image-wrapper:hover
.product-image {
  transform: scale(1.04);
}

.product-info {
  min-width: 0;
}

.product-name {
  margin: 0;

  color: var(--text);

  font-size: 13px;
  font-weight: 800;

  line-height: 1.35;
}

.product-meta {
  margin: 5px 0 0;

  color: var(--muted);

  font-size: 10px;
  line-height: 1.4;
}


/* Código especialmente destacado */

.product-meta strong {
  display: inline-flex;

  margin-right: 4px;

  border-radius: 5px;

  background: var(--building-soft);

  color: var(--building);

  padding: 2px 5px;

  font-size: 9px;
  font-weight: 900;

  text-transform: uppercase;
}

.product-quantity {
  display: inline-flex;
  align-items: center;

  margin-top: 7px;

  border-radius: 999px;

  background: var(--brand-soft);

  color: var(--brand);

  padding: 4px 8px;

  font-size: 9px;
  font-weight: 900;
}


/* =========================================================
   NOTES
========================================================= */

.order-notes textarea {
  width: 100%;
  min-height: 94px;

  resize: vertical;

  margin-bottom: 9px;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: var(--surface-soft);

  color: var(--text);

  outline: none;

  padding: 11px;

  font-size: 11px;

  transition:
    border 0.15s ease,
    background 0.15s ease;
}

.order-notes textarea:focus {
  border-color: #93c5fd;

  background: white;

  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.07);
}


/* =========================================================
   HISTORY
========================================================= */

.history-list {
  display: grid;
  gap: 8px;

  margin-top: 10px;
}

.history-item {
  position: relative;

  padding: 10px 11px 10px 31px;

  border-left: 2px solid var(--border);

  background: var(--surface-soft);

  border-radius: 0 9px 9px 0;

  color: var(--text-soft);

  font-size: 10px;

  line-height: 1.4;
}

.history-item::before {
  content: "";

  position: absolute;

  left: -6px;
  top: 13px;

  width: 10px;
  height: 10px;

  border: 2px solid white;
  border-radius: 50%;

  background: var(--brand);

  box-shadow:
    0 0 0 1px var(--brand);
}

.history-time {
  display: block;

  margin-top: 3px;

  color: var(--muted-light);

  font-size: 9px;
}


/* =========================================================
   MODAL ACTIONS
========================================================= */

.modal-actions {
  position: sticky;

  bottom: -100px;

  z-index: 3;

  display: flex;
  justify-content: space-between;
  gap: 10px;

  padding-top: 18px;

  border-top: 1px solid var(--border);

  background: white;
}

.modal-actions .button {
  flex: 1;

  min-height: 45px;
}


/* =========================================================
   TOAST
========================================================= */

.toast {
  position: fixed;

  right: 22px;
  bottom: 22px;

  z-index: 300;

  min-width: 240px;

  border-radius: 11px;

  background: var(--header);
  color: white;

  padding: 13px 16px;

  box-shadow: var(--shadow-lg);

  font-size: 11px;
  font-weight: 700;
}


/* =========================================================
   IMAGE VIEWER
========================================================= */

.image-viewer {
  position: fixed;
  inset: 0;

  z-index: 500;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background:
    rgba(2, 6, 23, 0.92);

  backdrop-filter: blur(6px);
}

.image-viewer-img {
  max-width: 94vw;
  max-height: 90vh;

  width: auto;
  height: auto;

  object-fit: contain;

  border-radius: 12px;

  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.55);
}

.image-viewer-close {
  position: fixed;

  top: 20px;
  right: 22px;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 12px;

  background:
    rgba(255, 255, 255, 0.08);

  color: white;

  font-size: 29px;
  line-height: 1;

  z-index: 510;
}

.image-viewer-close:hover {
  background:
    rgba(255, 255, 255, 0.15);
}


/* =========================================================
   UTILIDADES
========================================================= */

.hidden {
  display: none !important;
}


/* =========================================================
   TABLET / NOTEBOOK
========================================================= */

@media (max-width: 1180px) {

  :root {
    --sidebar-width: 180px;
  }

  .main-container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .order-card-inner {
    grid-template-columns:
      minmax(170px, 0.8fr)
      minmax(180px, 1fr)
      minmax(170px, 0.7fr);

    gap: 14px;
  }

  .header-search {
    width: 270px;
  }

}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {

  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    display: none;
  }

  .main-container {
    width: 100%;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
  }

  .header-search {
    flex: 1;
    width: auto;
  }

  .order-card-inner {
    grid-template-columns:
      minmax(150px, 0.8fr)
      minmax(170px, 1fr);

    gap: 14px;
  }

  .order-status-row {
    grid-column:
      1 / -1;

    padding-top: 10px;

    border-top:
      1px solid var(--border);
  }

  .modal {
    width: min(600px, 94vw);
  }

}


/* =========================================================
   CELULAR
========================================================= */

@media (max-width: 650px) {

  :root {
    --topbar-height: 66px;
  }

  .topbar-inner {
    padding:
      0 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 39px;
    height: 39px;

    flex-basis: 39px;
  }

  .brand-copy h1 {
    font-size: 14px;
  }

  .brand-copy p {
    font-size: 10px;
  }

  .topbar-icon-button {
    display: none;
  }

  .user-copy {
    display: none;
  }

  .user-avatar {
    width: 37px;
    height: 37px;
  }


  /* Main */

  .main-container {
    padding:
      20px
      12px
      50px;
  }

  .page-heading {
    margin-bottom: 17px;
  }

  .page-heading h2 {
    font-size: 26px;
  }

  .page-heading p {
    font-size: 11px;
  }


  /* Search */

  .heading-actions {
    display: grid;

    grid-template-columns:
      1fr auto;
  }

  .header-search {
    width: 100%;
  }

  .refresh-button {
    padding-left: 12px;
    padding-right: 12px;
  }


  /* Stats */

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 8px;
  }

  .stat-card {
    min-height: 108px;

    gap: 10px;

    padding: 14px 12px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;

    flex-basis: 32px;
  }

  .stat-number {
    font-size: 24px;
  }

  .stat-label {
    margin-top: 6px;

    font-size: 11px;
  }

  .stat-helper {
    font-size: 9px;
  }


  /* Filters */

  .filters-panel {
    padding: 10px;
  }

  .filter-buttons,
  .status-filters {
    flex-wrap: nowrap;

    overflow-x: auto;

    padding-bottom: 3px;

    scrollbar-width: none;
  }

  .filter-buttons::-webkit-scrollbar,
  .status-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-button,
  .status-filter {
    flex: 0 0 auto;

    min-height: 34px;

    padding:
      6px 10px;
  }


  /* Order title */

  .orders-heading {
    margin-top: 4px;
  }

  .orders-heading h3 {
    font-size: 14px;
  }


  /* Cards */

  .order-card-inner {
    display: block;

    min-height: 0;

    padding:
      15px
      14px
      14px
      18px;
  }

  .order-card-top {
    align-items: flex-start;
  }

  .order-number {
    font-size: 19px;
  }

  .order-card-products {
    margin-top: 14px;
  }

  .order-thumb {
    width: 48px;
    height: 48px;

    flex-basis: 48px;
  }

  .order-status-row {
    margin-top: 14px;

    padding-top: 12px;

    border-top:
      1px solid var(--border);
  }


  /* Drawer */

  .modal-overlay {
    display: block;

    background: white;
  }

  .modal {
    width: 100%;
    min-height: 100vh;

    box-shadow: none;

    border-left: 0;
  }

  .modal-header {
    padding:
      17px
      15px;
  }

  .modal-content {
    padding:
      19px
      15px
      90px;
  }

  .modal-title-row h2 {
    font-size: 24px;
  }

  .progress-steps {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .product-item {
    grid-template-columns:
      74px
      minmax(0, 1fr);
  }

  .product-image-wrapper {
    width: 74px;
    height: 74px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .button {
    width: 100%;
  }

}


/* =========================================================
   CELULAR PEQUEÑO
========================================================= */

@media (max-width: 390px) {

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-icon {
    display: none;
  }

  .heading-actions {
    grid-template-columns: 1fr;
  }

  .refresh-button {
    width: 100%;
  }

  .order-product-summary {
    font-size: 10px;
  }

}

/* =========================================================
   INCIDENCIAS POR PRODUCTO
========================================================= */

.incident-report-button {
  margin-top: 10px;

  border: 1px solid #fecaca;
  border-radius: 8px;

  background: #fff;

  color: #dc2626;

  padding: 6px 9px;

  font-size: 9px;
  font-weight: 800;
}

.incident-report-button:hover {
  background: #fef2f2;
}


.product-incident {
  margin-top: 10px;

  border-radius: 9px;

  padding: 9px 10px;

  font-size: 10px;
}


.product-incident.active {
  border: 1px solid #fecaca;

  background: #fef2f2;

  color: #991b1b;
}


.product-incident.resolved {
  border: 1px solid #bbf7d0;

  background: #f0fdf4;

  color: #166534;

  font-weight: 700;
}


.incident-header {
  margin-bottom: 6px;

  font-size: 10px;
  font-weight: 900;

  text-transform: uppercase;
}


.incident-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 5px;
}


.incident-time {
  display: block;

  color: #b91c1c;

  font-size: 9px;
}


.incident-resolve-button {
  width: 100%;

  margin-top: 9px;

  border: 0;
  border-radius: 7px;

  background: #dc2626;

  color: #fff;

  padding: 7px 9px;

  font-size: 9px;
  font-weight: 900;
}


.incident-resolve-button:hover {
  background: #b91c1c;
}
/* =========================================================
   MODAL DE INCIDENCIAS
========================================================= */

.incident-modal {
  position: fixed;
  inset: 0;

  z-index: 700;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.incident-modal.is-open {
  display: flex;
}

.incident-modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(15, 23, 42, 0.58);

  backdrop-filter: blur(5px);
}

.incident-modal-card {
  position: relative;

  z-index: 2;

  width: min(440px, 100%);

  border: 1px solid var(--border);
  border-radius: 18px;

  background: var(--surface);

  padding: 26px;

  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.28);

  animation:
    incidentModalIn 0.18s ease;
}

@keyframes incidentModalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.incident-modal-close {
  position: absolute;

  top: 15px;
  right: 15px;

  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface-soft);
  color: var(--text-soft);

  font-size: 22px;
  line-height: 1;
}

.incident-modal-close:hover {
  background: var(--surface-hover);
}

.incident-modal-label {
  display: inline-flex;

  margin-bottom: 9px;

  border-radius: 999px;

  background: var(--danger-soft);
  color: var(--danger);

  padding: 5px 8px;

  font-size: 9px;
  font-weight: 900;

  letter-spacing: 0.08em;
}

.incident-modal-card h3 {
  margin: 0;

  color: var(--text);

  font-size: 22px;
  font-weight: 900;

  letter-spacing: -0.025em;
}

.incident-modal-product {
  margin: 8px 0 0;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.45;
}

.incident-modal-question {
  margin: 22px 0 10px;

  color: var(--text-soft);

  font-size: 12px;
  font-weight: 800;
}


/* =========================================================
   MOTIVOS
========================================================= */

.incident-reason-options {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 10px;
}

.incident-reason-button {
  min-height: 92px;

  display: flex;
  align-items: center;
  gap: 12px;

  border: 1px solid var(--border);
  border-radius: 13px;

  background: var(--surface);

  color: var(--text);

  padding: 13px;

  text-align: left;

  transition:
    transform 0.15s ease,
    border 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.incident-reason-button:hover {
  transform: translateY(-1px);

  box-shadow: var(--shadow-sm);
}

.incident-reason-button.selected {
  border-color: #fca5a5;

  background: var(--danger-soft);

  box-shadow:
    0 0 0 3px rgba(239, 68, 68, 0.07);
}

.incident-reason-icon {
  width: 34px;
  height: 34px;

  flex: 0 0 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  font-size: 16px;
  font-weight: 900;
}

.incident-reason-button.damaged
.incident-reason-icon {
  background: #fff7ed;
  color: #ea580c;
}

.incident-reason-button.broken
.incident-reason-icon {
  background: #fef2f2;
  color: #dc2626;
}

.incident-reason-button strong {
  display: block;

  font-size: 11px;
  font-weight: 900;
}

.incident-reason-button small {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 9px;
  line-height: 1.3;
}


/* =========================================================
   CANTIDAD
========================================================= */

.incident-quantity-section {
  margin-top: 8px;
}

.incident-quantity-control {
  width: 170px;

  display: grid;
  grid-template-columns: 46px 1fr 46px;

  align-items: center;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: var(--surface);
}

.incident-quantity-control button {
  height: 44px;

  border: 0;

  background: var(--surface-soft);

  color: var(--text);

  font-size: 20px;
  font-weight: 700;
}

.incident-quantity-control button:hover {
  background: var(--surface-hover);
}

.incident-quantity-control strong {
  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--text);

  font-size: 15px;
  font-weight: 900;
}

.incident-quantity-available {
  margin: 7px 0 0;

  color: var(--muted);

  font-size: 9px;
}


/* =========================================================
   ACCIONES
========================================================= */

.incident-confirm-button {
  width: 100%;
  min-height: 44px;

  margin-top: 16px;

  border: 0;
  border-radius: 10px;

  background: var(--danger);

  color: white;

  font-size: 11px;
  font-weight: 900;
}

.incident-confirm-button:hover {
  background: var(--danger-hover);
}

.incident-cancel-button {
  width: 100%;

  margin-top: 10px;

  border: 0;

  background: transparent;

  color: var(--muted);

  padding: 8px;

  font-size: 10px;
  font-weight: 700;
}

.incident-cancel-button:hover {
  color: var(--text);
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 520px) {

  .incident-modal {
    align-items: flex-end;

    padding: 0;
  }

  .incident-modal-card {
    width: 100%;

    border-radius:
      18px
      18px
      0
      0;

    padding:
      23px
      17px
      20px;
  }

  .incident-reason-options {
    grid-template-columns: 1fr;
  }

  .incident-reason-button {
    min-height: 75px;
  }

  .incident-quantity-control {
    width: 100%;
  }

}

/* =========================================================
   FILTROS POR LUGAR DE ARMADO
========================================================= */

.location-filters {
  display: flex;
  align-items: center;
  gap: 8px;

  flex-wrap: wrap;

  margin-top: 12px;
  padding-top: 12px;

  border-top: 1px solid var(--border);
}

.location-filter-label {
  margin-right: 4px;

  color: var(--muted);

  font-size: 10px;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.location-filter {
  min-height: 34px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface);

  color: var(--text-soft);

  padding: 6px 11px;

  font-size: 10px;
  font-weight: 800;

  transition:
    background 0.15s ease,
    border 0.15s ease,
    color 0.15s ease;
}

.location-filter:hover {
  background: var(--surface-hover);
}

.location-filter.active {
  border-color: #c7d2fe;

  background: #eef2ff;

  color: #4f46e5;
}


/* =========================================================
   LUGAR DE ARMADO DENTRO DEL PEDIDO
========================================================= */

.assembly-location-section {
  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: var(--surface-soft);
}

.assembly-location-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  margin-top: 10px;
}

.assembly-location-control label {
  color: var(--text-soft);

  font-size: 11px;
  font-weight: 700;
}

.assembly-location-control select {
  min-width: 180px;
  min-height: 38px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface);

  color: var(--text);

  padding: 7px 10px;

  outline: none;

  font-size: 11px;
  font-weight: 800;
}

.assembly-location-control select:focus {
  border-color: #a5b4fc;

  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.08);
}


/* =========================================================
   BADGES DE LUGAR DE ARMADO
========================================================= */

.assembly-location-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  padding: 5px 9px;

  font-size: 9px;
  font-weight: 900;

  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.location-unassigned {
  border: 1px solid #cbd5e1;

  background: #f8fafc;

  color: #64748b;
}

.location-las-condes {
  border: 1px solid #bfdbfe;

  background: #eff6ff;

  color: #2563eb;
}

.location-patronato {
  border: 1px solid #ddd6fe;

  background: #f5f3ff;

  color: #7c3aed;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 650px) {

  .location-filters {
    flex-wrap: nowrap;

    overflow-x: auto;

    scrollbar-width: none;
  }

  .location-filters::-webkit-scrollbar {
    display: none;
  }

  .location-filter {
    flex: 0 0 auto;
  }

  .location-filter-label {
    flex: 0 0 auto;
  }

  .assembly-location-control {
    align-items: stretch;
    flex-direction: column;
  }

  .assembly-location-control select {
    width: 100%;
    min-width: 0;
  }

}

/* =========================================================
   COLOR DE TARJETA SEGÚN LUGAR DE ARMADO
========================================================= */

/* Sin asignar */
.order-card.location-card-sin-asignar {
  background: #ffffff;
}

/* Las Condes */
.order-card.location-card-las-condes {
  background: #f4f8ff;
  border-color: #cfe0ff;
}

.order-card.location-card-las-condes::before {
  background: #3b82f6;
}

/* Patronato */
.order-card.location-card-patronato {
  background: #faf7ff;
  border-color: #e4d8ff;
}

.order-card.location-card-patronato::before {
  background: #8b5cf6;
}

/* =========================================================
   ESTADO DE BODEGA POR PRODUCTO
========================================================= */

.warehouse-product-actions {
  display: flex;
  align-items: center;
  gap: 8px;

  margin-top: 10px;

  flex-wrap: wrap;
}


/* =========================================================
   BOTÓN: BAJADO
========================================================= */

.warehouse-product-ready-button {
  min-height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  border: 1px solid #bbf7d0;
  border-radius: 8px;

  background: #f0fdf4;

  color: #15803d;

  padding: 6px 10px;

  font-size: 10px;
  font-weight: 900;

  transition:
    background 0.15s ease,
    border 0.15s ease,
    transform 0.15s ease;
}

.warehouse-product-ready-button:hover {
  background: #dcfce7;
  border-color: #86efac;

  transform: translateY(-1px);
}


/* =========================================================
   BOTÓN: NO HAY AQUÍ
========================================================= */

.warehouse-product-missing-button {
  min-height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  border: 1px solid #fed7aa;
  border-radius: 8px;

  background: #fff7ed;

  color: #c2410c;

  padding: 6px 10px;

  font-size: 10px;
  font-weight: 900;

  transition:
    background 0.15s ease,
    border 0.15s ease,
    transform 0.15s ease;
}

.warehouse-product-missing-button:hover {
  background: #ffedd5;
  border-color: #fdba74;

  transform: translateY(-1px);
}


/* =========================================================
   PRODUCTO YA BAJADO
========================================================= */

.warehouse-product-status {
  margin-top: 10px;

  border-radius: 9px;

  padding: 8px 10px;

  font-size: 10px;
  font-weight: 800;
}

.warehouse-product-status.ready {
  border: 1px solid #bbf7d0;

  background: #f0fdf4;

  color: #15803d;
}


/* =========================================================
   PRODUCTO EN TRASLADO
========================================================= */

.warehouse-product-status.transfer {
  border: 1px solid #fed7aa;

  background: #fff7ed;

  color: #c2410c;
}

.warehouse-product-status.transfer strong {
  font-weight: 900;
}


/* =========================================================
   BOTÓN DESHACER
========================================================= */

.warehouse-reset-button {
  margin-top: 7px;

  border: 0;

  background: transparent;

  color: var(--muted);

  padding: 3px 0;

  font-size: 9px;
  font-weight: 700;
}

.warehouse-reset-button:hover {
  color: var(--text);
}


/* =========================================================
   SEPARAR ACCIONES DE INCIDENCIA
========================================================= */

.incident-report-button {
  margin-top: 10px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 520px) {

  .warehouse-product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;

    width: 100%;
  }

  .warehouse-product-ready-button,
  .warehouse-product-missing-button {
    width: 100%;

    min-height: 38px;
  }

}
/* =========================================================
   RESUMEN DE PREPARACIÓN DE PRODUCTOS
========================================================= */

#modal-product-count {
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

#modal-product-count.products-pending {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

#modal-product-count.products-complete {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

/* =========================================================
   LOGIN
========================================================= */

.login-screen {
  position: fixed;
  inset: 0;

  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  background:
    linear-gradient(
      135deg,
      #f8fafc,
      #eef2ff
    );
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);

  border: 1px solid var(--border);
  border-radius: 22px;

  background: var(--surface);

  padding: 28px;

  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.16);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 30px;
}

.login-logo {
  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background: var(--text);
  color: white;

  font-size: 14px;
  font-weight: 900;
}

.login-brand h1 {
  margin: 0;

  font-size: 17px;
  font-weight: 900;
}

.login-brand p {
  margin: 3px 0 0;

  color: var(--muted);

  font-size: 10px;
}

.login-heading {
  margin-bottom: 22px;
}

.login-kicker {
  display: inline-flex;

  margin-bottom: 8px;

  color: #6366f1;

  font-size: 9px;
  font-weight: 900;

  letter-spacing: 0.1em;
}

.login-heading h2 {
  margin: 0;

  color: var(--text);

  font-size: 25px;
  font-weight: 900;

  letter-spacing: -0.03em;
}

.login-heading p {
  margin: 7px 0 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.5;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;

  margin-bottom: 15px;
}

.login-field label {
  color: var(--text-soft);

  font-size: 10px;
  font-weight: 800;
}

.login-field input {
  width: 100%;
  min-height: 44px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background: var(--surface);

  color: var(--text);

  padding: 9px 11px;

  outline: none;

  font-size: 12px;
}

.login-field input:focus {
  border-color: #a5b4fc;

  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.08);
}

.login-submit {
  width: 100%;
  min-height: 45px;

  margin-top: 4px;

  border: 0;
  border-radius: 10px;

  background: #111827;

  color: white;

  font-size: 11px;
  font-weight: 900;
}

.login-submit:hover {
  background: #1f2937;
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

.login-error {
  margin-bottom: 12px;

  border: 1px solid #fecaca;
  border-radius: 9px;

  background: #fef2f2;

  color: #b91c1c;

  padding: 9px 10px;

  font-size: 10px;
  font-weight: 700;
}


/* =========================================================
   USUARIOS
========================================================= */

.users-section {
  width: 100%;
}

.users-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 20px;
}

.users-page-heading h2 {
  margin: 4px 0 5px;

  color: var(--text);

  font-size: 26px;
  font-weight: 900;

  letter-spacing: -0.03em;
}

.users-page-heading p {
  margin: 0;

  color: var(--muted);

  font-size: 11px;
}

.users-list {
  display: grid;
  grid-template-columns:
    repeat(
      auto-fill,
      minmax(260px, 1fr)
    );

  gap: 14px;
}

.user-card {
  border: 1px solid var(--border);
  border-radius: 14px;

  background: var(--surface);

  padding: 16px;

  box-shadow: var(--shadow-sm);
}

.user-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.user-card-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-card-avatar {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 40px;

  border-radius: 11px;

  background: #f1f5f9;

  color: #334155;

  font-size: 11px;
  font-weight: 900;
}

.user-card-name {
  margin: 0;

  color: var(--text);

  font-size: 13px;
  font-weight: 900;
}

.user-card-username {
  margin-top: 3px;

  color: var(--muted);

  font-size: 9px;
}

.user-status-badge {
  display: inline-flex;
  align-items: center;

  border-radius: 999px;

  padding: 4px 7px;

  font-size: 8px;
  font-weight: 900;

  text-transform: uppercase;
}

.user-status-active {
  background: #f0fdf4;
  color: #15803d;
}

.user-status-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.user-card-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;

  margin-top: 14px;
}

.user-role-badge,
.user-location-badge {
  display: inline-flex;

  border-radius: 999px;

  padding: 5px 8px;

  font-size: 8px;
  font-weight: 900;
}

.user-role-badge {
  background: #eef2ff;
  color: #4f46e5;
}

.user-location-badge {
  background: #f8fafc;
  color: #475569;

  border: 1px solid #e2e8f0;
}

.user-card-actions {
  display: flex;
  justify-content: flex-end;

  margin-top: 15px;
}

.user-edit-button {
  border: 1px solid var(--border);
  border-radius: 8px;

  background: var(--surface);

  color: var(--text-soft);

  padding: 6px 10px;

  font-size: 9px;
  font-weight: 800;
}

.user-edit-button:hover {
  background: var(--surface-hover);
}


/* =========================================================
   MODAL USUARIO
========================================================= */

.user-modal-card {
  width: min(520px, calc(100% - 30px));

  max-height: calc(100vh - 40px);

  overflow-y: auto;

  border: 1px solid var(--border);
  border-radius: 18px;

  background: var(--surface);

  padding: 22px;

  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.2);
}

.user-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 20px;
}

.user-modal-header h3 {
  margin: 5px 0 0;

  color: var(--text);

  font-size: 20px;
  font-weight: 900;
}

.user-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;

  margin-bottom: 15px;
}

.user-form-field label {
  color: var(--text-soft);

  font-size: 10px;
  font-weight: 800;
}

.user-form-field input,
.user-form-field select {
  width: 100%;
  min-height: 41px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface);

  color: var(--text);

  padding: 8px 10px;

  outline: none;

  font-size: 11px;
}

.user-form-field input:focus,
.user-form-field select:focus {
  border-color: #a5b4fc;

  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.08);
}

.user-form-field small {
  color: var(--muted);

  font-size: 8px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 12px;
}

.user-active-control {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 3px 0 18px;

  color: var(--text-soft);

  font-size: 10px;
  font-weight: 700;
}

.user-active-control input {
  width: 15px;
  height: 15px;
}

.user-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;

  margin-top: 20px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 650px) {

  .login-card {
    padding: 22px 18px;
  }

  .users-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .users-page-heading .button {
    width: 100%;
  }

  .users-list {
    grid-template-columns: 1fr;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .user-modal-card {
    width: 100%;

    max-height: 92vh;

    margin-top: auto;

    border-radius:
      18px
      18px
      0
      0;
  }

}
