/* ══════════════════════════════════════════════
   CloudWare MX — styles.css  (Rediseño v2)
══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables: Light Mode ── */
:root {
  --accent:          #7c3aed;
  --accent-light:    #8b5cf6;
  --accent-dark:     #6d28d9;
  --accent-glow:     rgba(124,58,237,0.18);

  --bg:              #f4f4f8;
  --sidebar-bg:      #111014;
  --sidebar-border:  rgba(255,255,255,0.06);
  --card-bg:         #ffffff;
  --card-border:     #e8e8ee;

  --text:            #111014;
  --text-sub:        #6b6b80;
  --text-sidebar:    #9494a8;
  --text-sidebar-active: #ffffff;

  --green:           #22c55e;
  --green-bg:        #dcfce7;
  --green-text:      #15803d;
  --amber:           #f59e0b;
  --amber-bg:        #fef3c7;
  --amber-text:      #92400e;
  --red:             #ef4444;
  --red-bg:          #fee2e2;
  --red-text:        #b91c1c;
  --pink:            #ec4899;
  --pink-bg:         #fce7f3;
  --pink-text:       #9d174d;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.16);

  --radius:    14px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --sidebar-w: 260px;
  --topbar-h:  0px;
}

/* ── Variables: Dark Mode ── */
body.dark {
  --bg:           #0d0d10;
  --card-bg:      #1a1a22;
  --card-border:  rgba(255,255,255,0.07);
  --text:         #f0f0f8;
  --text-sub:     #6b6b80;

  --green-bg:    rgba(34,197,94,0.15);
  --green-text:  #4ade80;
  --amber-bg:    rgba(245,158,11,0.15);
  --amber-text:  #fbbf24;
  --red-bg:      rgba(239,68,68,0.15);
  --red-text:    #f87171;
  --pink-bg:     rgba(236,72,153,0.15);
  --pink-text:   #f472b6;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

/* ── Dark mode: Login ── */
body.dark .login-screen {
  background: linear-gradient(135deg, #0d0d10 0%, #1a0a2e 50%, #0f0f1a 100%);
}
body.dark .login-card {
  background: rgba(26, 20, 46, 0.85);
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
body.dark .login-logo {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 10px 30px rgba(124,58,237,0.3);
}
body.dark .login-title { color: #f0f0f8; }
body.dark .login-sub   { color: rgba(200,190,255,0.6); }
body.dark .login-field label { color: rgba(200,190,255,0.75); }
body.dark .login-field input {
  background: rgba(255,255,255,0.06);
  border-color: rgba(139,92,246,0.25);
  color: #f0f0f8;
}
body.dark .login-field input::placeholder { color: #6b5f90; }
body.dark .login-field input:focus {
  border-color: rgba(139,92,246,0.7);
  background: rgba(255,255,255,0.09);
}
body.dark .login-btn {
  background: #6d28d9;
}
body.dark .login-btn:hover { background: #5b21b6; }
body.dark .login-recover   { color: rgba(180,160,255,0.45); }
body.dark .login-recover:hover { color: rgba(180,160,255,0.9); }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  transition: background .3s, color .3s;
  overflow-x: hidden;
}

/* ═══════════════════════════════
   LOGIN
═══════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 40%, #a855f7 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .4s;
}
.login-screen.hidden { opacity: 0; pointer-events: none; }

.login-card {
  background: rgba(180,140,230,0.32);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 24px;
  padding: 48px 40px 40px;
  width: 420px;
  max-width: 94vw;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.3);
}

.login-logo {
  width: 165px; height: 165px;
  border-radius: 34px;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  border: 3px solid rgba(255,255,255,0.3);
  background: #fff;
}
.login-logo img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

.login-title { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.login-sub   { font-size: 13px; color: rgba(255,255,255,0.65); margin-bottom: 32px; }

.login-field { text-align: left; margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.8); margin-bottom: 7px; letter-spacing: .4px;
}
.login-field input {
  width: 100%; padding: 13px 16px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.88);
  border: 2px solid transparent;
  border-radius: 12px;
  font-family: inherit; font-size: 14px;
  color: #1a0a2e;
  outline: none; transition: border-color .2s, background .2s;
}
.login-field input:focus { border-color: rgba(255,255,255,0.6); background: #fff; }
.login-field input::placeholder { color: #9985b0; }

.login-btn {
  width: 100%; padding: 14px;
  background: #4c1d8a;
  color: #fff; border: none; border-radius: 12px;
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 8px;
  transition: background .2s, transform .15s;
  letter-spacing: .3px;
}
.login-btn:hover  { background: #3b1570; }
.login-btn:active { transform: scale(.98); }

.login-recover {
  display: block; margin-top: 18px;
  font-size: 12px; color: rgba(255,255,255,0.55);
  cursor: pointer; text-decoration: none;
  transition: color .2s;
}
.login-recover:hover { color: rgba(255,255,255,0.9); }

/* ═══════════════════════════════
   SIDEBAR
═══════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 20;
  border-right: 1px solid var(--sidebar-border);
  transition: background .3s;
}

.sidebar-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  text-align: center;
}
.sidebar-logo {
  width: 90px; height: 90px;
  border-radius: 20px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: #fff;
  border: 2px solid rgba(139,92,246,0.45);
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}
.sidebar-logo img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}
.brand-name { font-size: 17px; font-weight: 800; color: #fff; line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--text-sidebar); }

.sidebar-nav { list-style: none; padding: 14px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  color: var(--text-sidebar); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .18s;
  text-decoration: none; user-select: none;
}
.sidebar-nav a .nav-icon {
  width: 20px; height: 20px; flex-shrink: 0; opacity: .7;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a:hover .nav-icon { opacity: 1; }
.sidebar-nav a.active {
  background: linear-gradient(90deg, var(--accent), #a855f7);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 10px rgba(124,58,237,0.4);
}
.sidebar-nav a.active .nav-icon { opacity: 1; }

/* Bottom menu popup */
.sidebar-bottom {
  padding: 10px;
  border-top: 1px solid var(--sidebar-border);
  position: relative;
}
.sidebar-user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background .18s;
}
.sidebar-user-btn:hover { background: rgba(255,255,255,0.07); }
.user-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c026d3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-av-name { font-size: 13px; font-weight: 600; color: #fff; display: block; line-height: 1.3; }
.user-av-role { font-size: 11px; color: var(--text-sidebar); }

/* Popup menu */
.sidebar-popup {
  position: absolute; bottom: calc(100% + 4px); left: 10px; right: 10px;
  background: #1e1e28;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 50;
}
.sidebar-popup.open { display: block; }
.popup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer;
  font-size: 13px; color: #e0e0f0;
  transition: background .15s; font-weight: 500;
}
.popup-item:hover   { background: rgba(255,255,255,0.07); }
.popup-item.danger  { color: #f87171; }
.popup-item svg     { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }

/* ═══════════════════════════════
   MAIN LAYOUT
═══════════════════════════════ */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.page-content {
  flex: 1; overflow-y: auto;
  padding: 36px 36px 48px;
}

/* Sections */
.section { display: none; }
.section.active { display: block; }

/* Page header */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.page-header p  { font-size: 13px; color: var(--text-sub); margin-top: 5px; }

/* ═══════════════════════════════
   DASHBOARD STAT CARDS
═══════════════════════════════ */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: space-between;
  transition: background .3s, border-color .3s;
}
.stat-info .stat-label { font-size: 12px; color: var(--text-sub); font-weight: 500; margin-bottom: 6px; }
.stat-info .stat-value { font-size: 36px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-icon-wrap {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap svg { width: 22px; height: 22px; }
.stat-card.s-red    .stat-icon-wrap { background: var(--red-bg); color: var(--red); }
.stat-card.s-red    .stat-value     { color: var(--red); }
.stat-card.s-amber  .stat-icon-wrap { background: var(--amber-bg); color: var(--amber); }
.stat-card.s-amber  .stat-value     { color: var(--amber); }
.stat-card.s-green  .stat-icon-wrap { background: var(--green-bg); color: var(--green); }
.stat-card.s-green  .stat-value     { color: var(--green); }
.stat-card.s-purple .stat-icon-wrap { background: rgba(124,58,237,.12); color: var(--accent-light); }
.stat-card.s-purple .stat-value     { color: var(--accent-light); }

/* Dashboard grid */
.dash-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; margin-top: 4px;
}
.dash-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: background .3s;
  display: flex; flex-direction: column;
}
.dash-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.dash-card .bar-chart-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
}

/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 18px; height: 200px; padding-bottom: 28px; padding-top: 28px; position: relative; }
.bar-chart::after {
  content: '';
  position: absolute; bottom: 28px; left: 0; right: 0;
  height: 1px; background: var(--card-border);
}
.bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.bar-col {
  width: 100%; border-radius: 6px 6px 0 0;
  transition: height .5s ease;
  position: relative;
}
.bar-col.c-purple { background: linear-gradient(180deg, #8b5cf6, #6d28d9); }
.bar-col.c-violet { background: linear-gradient(180deg, #a855f7, #7c3aed); }
.bar-col.c-pink   { background: linear-gradient(180deg, #ec4899, #c026d3); }
.bar-col.c-indigo { background: linear-gradient(180deg, #6366f1, #4338ca); }
.bar-label { font-size: 11px; color: var(--text-sub); font-weight: 500; }
.bar-count { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--text-sub); white-space: nowrap; }

/* Alert list in dashboard */
.alert-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.alert-list::-webkit-scrollbar { width: 4px; }
.alert-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 99px; }

.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  transition: background .3s;
}
body.dark .alert-item { background: rgba(255,255,255,0.03); }
.alert-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert-dot svg { width: 16px; height: 16px; }
.alert-dot.red    { background: var(--red-bg); color: var(--red); }
.alert-dot.amber  { background: var(--amber-bg); color: var(--amber); }
.alert-info-txt { flex: 1; min-width: 0; }
.alert-info-txt strong { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-info-txt span   { font-size: 11px; color: var(--text-sub); }
.badge-sm {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}
.badge-sm.red   { background: var(--red-bg); color: var(--red-text); }
.badge-sm.amber { background: var(--amber-bg); color: var(--amber-text); }

/* ═══════════════════════════════
   TOOLBAR (search + buttons)
═══════════════════════════════ */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  transition: background .3s;
}
.search-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 9px 14px;
  transition: background .3s;
}
body.dark .search-wrap { background: rgba(255,255,255,0.05); }
.search-wrap svg { width: 16px; height: 16px; color: var(--text-sub); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--text);
  outline: none;
}
.search-input::placeholder { color: var(--text-sub); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; white-space: nowrap;
  transition: all .15s;
}
.btn-filter {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--card-border);
}
.btn-filter:hover { background: var(--bg); color: var(--text); }
.btn-filter svg { width: 15px; height: 15px; }
.btn-add {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}
.btn-add:hover { background: var(--accent-dark); }
.btn-del {
  background: #dc2626; color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.btn-del:hover { background: #b91c1c; }
.btn-pdf {
  background: #dc2626; color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.btn-pdf:hover { background: #b91c1c; }
.btn svg { width: 15px; height: 15px; }

/* ═══════════════════════════════
   TABLE
═══════════════════════════════ */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background .3s;
}
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table thead tr {
  border-bottom: 1px solid var(--card-border);
}
.inv-table thead th {
  padding: 13px 18px;
  text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: var(--text-sub);
}
body.dark .inv-table thead { background: rgba(255,255,255,0.02); }
.inv-table tbody tr { border-bottom: 1px solid var(--card-border); transition: background .12s; }
.inv-table tbody tr:last-child { border-bottom: none; }
.inv-table tbody tr:hover { background: rgba(124,58,237,0.04); }
body.dark .inv-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.inv-table td { padding: 14px 18px; vertical-align: middle; font-size: 13px; }

/* Image cell */
.img-cell {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* Folio */
.folio {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-sub);
  background: var(--bg);
  padding: 3px 8px; border-radius: 5px;
  transition: background .3s;
}

/* Product name */
.prod-name { font-weight: 600; font-size: 13.5px; }

/* Category */
.cat-text { font-size: 12px; color: var(--text-sub); }

/* Quantity */
.qty-num { font-size: 22px; font-weight: 800; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 6px; }
.step-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text); font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; line-height: 1;
  font-family: inherit;
}
.step-btn:hover { background: var(--accent-glow); border-color: var(--accent-light); color: var(--accent-light); }
.step-val { font-size: 16px; font-weight: 700; min-width: 28px; text-align: center; }

/* Status badges */
.status-badge {
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 99px;
  white-space: nowrap;
}
.status-badge.disponible { background: var(--green-bg); color: var(--green-text); }
.status-badge.stock-bajo  { background: var(--amber-bg); color: var(--amber-text); }
.status-badge.critico     { background: var(--pink-bg);  color: var(--pink-text); }
.status-badge.agotado     { background: var(--red-bg);   color: var(--red-text); }

/* Check toggle (herramientas/equipos) */
.check-toggle {
  width: 32px; height: 32px; border-radius: 8px;
  border: 2px solid var(--card-border);
  background: var(--bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all .15s;
}
.check-toggle.checked { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.check-toggle.crossed { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.check-label { font-size: 11px; color: var(--text-sub); margin-left: 6px; }

/* Action buttons */
.act-btn {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.act-btn svg { width: 15px; height: 15px; }
.act-edit { background: rgba(124,58,237,.1); color: var(--accent-light); }
.act-edit:hover { background: rgba(124,58,237,.2); }
.act-del  { background: rgba(239,68,68,.1); color: var(--red); }
.act-del:hover  { background: rgba(239,68,68,.2); }
.act-btns { display: flex; gap: 6px; }

/* ═══════════════════════════════
   MATERIALES REQUERIDOS
═══════════════════════════════ */
.req-filters { display: flex; gap: 8px; margin-bottom: 20px; }
.req-filter-btn {
  padding: 7px 16px; border-radius: 99px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 2px solid var(--card-border);
  background: var(--card-bg); color: var(--text-sub);
  transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.req-filter-btn.active {
  background: linear-gradient(90deg, var(--accent), #a855f7);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}

/* Secciones de requeridos */
.req-section { margin-bottom: 28px; }
.req-section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-sub);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.req-section-title span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; border-radius: 99px;
  font-size: 11px; padding: 0 6px;
}
.req-section-title span.alert-count { background: var(--amber-bg); color: var(--amber-text); }
.req-section-title span.out-count   { background: var(--red-bg); color: var(--red-text); }

/* ═══════════════════════════════
   MODALS
═══════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
  transition: opacity .2s;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 30px;
  width: 480px; max-width: 96vw;
  box-shadow: var(--shadow-xl);
  transition: background .3s;
}
.modal-hdr {
  font-size: 18px; font-weight: 700;
  margin-bottom: 22px; display: flex; align-items: center; gap: 10px;
}
.modal-form { display: flex; flex-direction: column; gap: 15px; }
.form-row   { display: flex; gap: 12px; }
.form-grp   { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.form-grp label { font-size: 11px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: .4px; }
.form-grp input,
.form-grp select {
  padding: 10px 13px;
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  font-family: inherit; font-size: 13px;
  background: var(--bg); color: var(--text);
  outline: none; transition: border-color .2s, background .3s;
}
.form-grp input:focus,
.form-grp select:focus { border-color: var(--accent-light); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.btn-cancel { background: var(--bg); color: var(--text); border: 1px solid var(--card-border); }
.btn-cancel:hover { background: var(--card-border); }
.btn-save   { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(124,58,237,.3); }
.btn-save:hover   { background: var(--accent-dark); }
.btn-confirm-del  { background: #dc2626; color: #fff; }
.btn-confirm-del:hover { background: #b91c1c; }

/* Confirm modal */
.confirm-modal { max-width: 360px; text-align: center; }
.confirm-modal .modal-hdr { justify-content: center; font-size: 16px; }
.confirm-modal p { font-size: 13px; color: var(--text-sub); margin-bottom: 22px; }
.confirm-modal .modal-footer { justify-content: center; }

/* Stock alert modal */
.stock-alert-modal { max-width: 420px; }
.stock-alert-modal .modal-hdr { font-size: 16px; justify-content: center; }
.stock-alert-modal p { font-size: 13px; color: var(--text-sub); text-align: center; margin-bottom: 16px; }
.stock-alert-list { max-height: 220px; overflow-y: auto; margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.stock-alert-item {
  padding: 9px 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--card-border);
  font-size: 12px; display: flex; align-items: center; gap: 8px;
}
.stock-alert-item strong { font-weight: 600; }
.stock-alert-modal .modal-footer { justify-content: center; }

/* ═══════════════════════════════
   MISC
═══════════════════════════════ */
.hidden { display: none !important; }

/* qty bar (under stepper) */
.qty-bar { height: 3px; border-radius: 99px; margin-top: 4px; width: 60px; background: var(--card-border); overflow: hidden; }
.qty-bar-fill { height: 100%; border-radius: 99px; transition: width .3s; }

/* empty state */
.empty-row td {
  text-align: center; padding: 40px;
  color: var(--text-sub); font-size: 13px;
}

/* scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 99px; }

/* ═══════════════════════════════
   CARROS DROPDOWN
═══════════════════════════════ */
.btn-carros {
  background: #7c3aed; color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
  gap: 7px;
}
.btn-carros:hover { background: #6d28d9; }
.btn-carros svg:first-child { width: 17px; height: 17px; }

.carros-wrap { position: relative; }

.carros-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  z-index: 200;
  overflow: hidden;
  display: none;
  transition: background .3s;
}
.carros-menu.open { display: block; }

.carros-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 16px;
  background: none; border: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: background .15s;
  text-align: left;
}
.carros-menu-item:hover { background: var(--accent-glow); color: var(--accent-light); }

/* ═══════════════════════════════
   CARRO MODAL
═══════════════════════════════ */
.carro-modal {
  width: 560px; max-width: 98vw;
  max-height: 88vh;
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
}

.carro-modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}
.carro-modal-title-wrap {
  display: flex; align-items: center; gap: 10px;
}
.carro-modal-title {
  font-size: 18px; font-weight: 800; color: var(--text);
}
.carro-edit-name {
  width: 30px; height: 30px; border-radius: 8px; border: none;
  background: rgba(124,58,237,.1); color: var(--accent-light);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.carro-edit-name:hover { background: rgba(124,58,237,.2); }
.carro-edit-name svg { width: 14px; height: 14px; }

.carro-header-btns { display: flex; align-items: center; gap: 8px; }
.carro-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg); color: var(--text-sub);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.carro-close:hover { background: var(--red-bg); color: var(--red); }
.carro-close svg { width: 16px; height: 16px; }

/* Progress bar */
.carro-progress {
  padding: 12px 24px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0; border-bottom: 1px solid var(--card-border);
}
.carro-progress-bar-wrap {
  flex: 1; height: 6px; background: var(--card-border);
  border-radius: 99px; overflow: hidden;
}
.carro-progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 99px; transition: width .4s ease;
}
.carro-progress-txt { font-size: 12px; color: var(--text-sub); white-space: nowrap; font-weight: 500; }

/* Items list */
.carro-items {
  flex: 1; overflow-y: auto;
  padding: 10px 16px;
}
.carro-items::-webkit-scrollbar { width: 4px; }
.carro-items::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 99px; }

.carro-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  margin-bottom: 3px;
  transition: background .12s;
  border: 1px solid transparent;
}
.carro-item:hover { background: var(--bg); }
.carro-item.ci-check { background: rgba(34,197,94,.07); border-color: rgba(34,197,94,.2); }
.carro-item.ci-cross { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.15); }

.ci-toggle {
  width: 30px; height: 30px; border-radius: 7px; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
  background: var(--card-border); color: var(--text-sub);
}
.ci-toggle svg { width: 15px; height: 15px; }
.carro-item.ci-check .ci-toggle { background: rgba(34,197,94,.2); color: #22c55e; }
.carro-item.ci-cross .ci-toggle { background: rgba(239,68,68,.15); color: var(--red); }
.ci-toggle:hover { transform: scale(1.1); }

.ci-name {
  flex: 1; font-size: 13px; font-weight: 500; color: var(--text);
}
.carro-item.ci-check .ci-name { color: var(--text-sub); text-decoration: line-through; }

.ci-del {
  width: 26px; height: 26px; border-radius: 6px; border: none;
  background: none; color: var(--text-sub);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all .15s; flex-shrink: 0;
}
.carro-item:hover .ci-del { opacity: 1; }
.ci-del:hover { background: var(--red-bg); color: var(--red); }
.ci-del svg { width: 13px; height: 13px; }

/* Add row */
.carro-add-row {
  display: flex; gap: 8px; align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--card-border);
  flex-shrink: 0;
}
.carro-new-input {
  flex: 1; padding: 9px 13px;
  border: 1.5px solid var(--card-border);
  border-radius: 9px;
  font-family: inherit; font-size: 13px;
  background: var(--bg); color: var(--text);
  outline: none; transition: border-color .2s, background .3s;
}
.carro-new-input:focus { border-color: var(--accent-light); }
.carro-new-input::placeholder { color: var(--text-sub); }

/* ── Carros menu rows with delete ── */
.carros-menu-row {
  display: flex; align-items: center;
}
.carros-menu-open {
  flex: 1; border-radius: 0;
}
.carros-menu-del-btn {
  width: 34px; height: 38px; flex-shrink: 0;
  border: none; background: none;
  color: var(--text-sub); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; padding-right: 10px;
}
.carros-menu-del-btn svg { width: 14px; height: 14px; }
.carros-menu-del-btn:hover { color: var(--red); background: var(--red-bg); }

.carros-menu-sep {
  height: 1px; background: var(--card-border);
  margin: 4px 0;
}
.carros-menu-add {
  color: var(--accent-light) !important;
  font-weight: 600;
  gap: 8px;
}
.carros-menu-add:hover { background: var(--accent-glow) !important; }

/* ── Mostrar / ocultar contraseña ─────────────────── */
.pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.pass-wrap input {
  flex: 1;
  min-width: 0;
  padding-right: 46px !important;
  box-sizing: border-box !important;
}
.pass-eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #7c3aed;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity .2s, color .2s;
  z-index: 5;
  line-height: 0;
}
.pass-eye:hover { opacity: 1; color: #4c1d8a; }
.pass-eye:focus { outline: none; }
body.dark .pass-eye { color: #c4b5fd; }
body.dark .pass-eye:hover { color: #fff; opacity: 1; }

/* ── Comentarios ──────────────────────────────────── */
.comentario-box {
  margin-top: 18px;
  background: var(--card, #fff);
  border: 1px solid rgba(124,58,237,0.15);
  border-radius: 14px;
  padding: 16px;
}
.comentario-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: #7c3aed;
  margin-bottom: 10px;
}
.comentario-input {
  width: 100%; box-sizing: border-box;
  border: 1.5px solid rgba(124,58,237,0.2);
  border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; color: #1a0a2e;
  resize: vertical; outline: none; transition: border-color .2s;
  background: #faf9ff;
}
.comentario-input:focus { border-color: #7c3aed; }
.comentario-save { margin-top: 10px; font-size: 13px; }
.comentario-status {
  margin-left: 12px; font-size: 12px; color: #22c55e; font-weight: 600;
}
body.dark .comentario-box { background: rgba(255,255,255,0.04); border-color: rgba(167,139,250,0.2); }
body.dark .comentario-input { background: rgba(255,255,255,0.06); color: #e9e4f5; border-color: rgba(167,139,250,0.2); }
body.dark .comentario-label { color: #c4b5fd; }

/* ── Botón Historial ──────────────────────────────── */
.btn-hist {
  background: #ede9fe; color: #7c3aed;
}
.btn-hist:hover { background: #ddd6fe; }
body.dark .btn-hist { background: rgba(124,58,237,0.2); color: #c4b5fd; }

/* ── Panel de Historial ───────────────────────────── */
.historial-panel {
  margin-top: 16px;
  border-top: 1.5px solid rgba(124,58,237,0.15);
  padding-top: 16px;
}
.historial-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.historial-title { font-size: 15px; font-weight: 700; color: #1a0a2e; }
body.dark .historial-title { color: #e9e4f5; }
.historial-list {
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.historial-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 10px;
  background: #faf9ff; border: 1px solid rgba(124,58,237,0.1);
  font-size: 13px;
}
body.dark .historial-item { background: rgba(255,255,255,0.04); border-color: rgba(167,139,250,0.15); }
.historial-item-info { display: flex; flex-direction: column; gap: 2px; }
.historial-item-name { font-weight: 600; color: #1a0a2e; }
body.dark .historial-item-name { color: #e9e4f5; }
.historial-item-fecha { font-size: 11px; color: #9985b0; }
.historial-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}
.historial-badge.disp   { background: #dcfce7; color: #15803d; }
.historial-badge.nodisp { background: #fee2e2; color: #b91c1c; }
.historial-badge.rev    { background: #fef9c3; color: #a16207; }
.historial-empty { text-align: center; color: #9985b0; font-size: 13px; padding: 20px; }

/* ── Acciones del historial (editar/eliminar) ─────── */
.historial-item-actions { display: flex; align-items: center; gap: 8px; }
.hist-edit, .hist-del {
  width: 28px; height: 28px; border: none; border-radius: 7px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.hist-edit svg, .hist-del svg { width: 14px; height: 14px; }
.hist-edit { background: #ede9fe; color: #7c3aed; }
.hist-edit:hover { background: #ddd6fe; }
.hist-del { background: #fee2e2; color: #ef4444; }
.hist-del:hover { background: #fecaca; }
body.dark .hist-edit { background: rgba(124,58,237,0.2); color: #c4b5fd; }
body.dark .hist-del { background: rgba(239,68,68,0.2); color: #fca5a5; }