:root{
  --bg:#202225; --card:#2a2c31; --card-2:#24262a;
  --accent:#ff8c1a; --accent-2:#ffad42; --text:#e8e8e8;
  --muted:#bdbdbd; --stroke:#3a3d44; --shadow:0 8px 22px rgba(0,0,0,.35); --radius:14px; --topbar-h:64px;
}
*{box-sizing:border-box}
html,body{height:100%}
html{scroll-padding-top:var(--topbar-h)}

body.theme-light{
  --bg:#f3f5f7;
  --card:#ffffff;
  --card-2:#f0f2f5;
  --text:#111827;
  --muted:#4b5563;
  --stroke:#d1d5db;
  --shadow:0 10px 26px rgba(0,0,0,.12);
}
body.theme-light .input{ background:#ffffff; color:#111827; }
body.theme-light .menu-item{ background:#ffffff; color:#111827; }
body.theme-light .menu-item:hover{ background:rgba(255,140,26,.12); }

body.theme-light .topbar{ background:linear-gradient(180deg,#ffffff 0%, #f3f5f7 100%); }
body.theme-light .sidebar{ background:var(--card-2); }
body.theme-light .panel-title{ background:#ffffff; color:#111827; }


body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

.bg-app{background:var(--bg)}

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.title{
  font-size:1.6rem;
  font-weight:800;
  color:#fff;
  margin:.25rem 0 1rem 0;
  text-align:center;
}
.subtitle{color:var(--muted)}
.center{text-align:center}
.mt-sm{margin-top:.75rem}
.mt-lg{margin-top:1.25rem}
.w-100{width:100%}

.tag{
  display:inline-block;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  color:var(--muted);
  background:var(--card-2);
}

.btn{
  border:0;
  padding:12px 16px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.btn-primary{
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#181818;
}
.btn-small{
  padding:6px 10px;
  border-radius:8px;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:#ffffff;
  color:#181818;
  border:1px solid rgba(0,0,0,.18);
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.btn-small:hover{filter:brightness(.98)}
.btn-small:active{transform:translateY(1px)}
.btn-small:hover{
  border-color:var(--accent);
  box-shadow:0 8px 18px rgba(0,0,0,.22);
}
.btn-small:active{ transform:translateY(1px); }
.btn-small:focus{ outline:2px solid rgba(255,140,26,.35); outline-offset:2px; }


/* inputs genéricos */
.input{
  background:#1f2024;
  border:1px solid var(--stroke);
  color:#fff;
  padding:11px 12px;
  border-radius:10px;
  width:100%;
}

/* tamaños específicos */
.input-qty{
  width:120px;      /* cantidad hasta 6 dígitos */
}
.input-date{
  width:180px;      /* solo fecha */
}
.input-datetime{
  width:230px;      /* fecha + hora */
}

.label{color:var(--muted);margin-top:.25rem}

.login-wrapper{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:32px;
}
.login-card{
  width:min(380px,94vw);
  text-align:center;
}
.brand-mark{
  width:64px;
  height:auto;
  display:block;
  margin:0 auto 8px auto;
}

/* ========= ICONOS ========= */

.icon-img{
  width:18px;
  height:18px;
  display:block;
  flex-shrink:0;
}

/* ========= PANEL ========= */

.topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:50;
  background:linear-gradient(180deg,#1b1d21 0%, #16171a 100%);
  border-bottom:1px solid var(--stroke);
  backdrop-filter:saturate(140%) blur(6px);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
}

/* grupos topbar */
.top-left{
  display:flex;
  align-items:center;
  gap:8px;
}
.top-center{
  flex:1;
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.top-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

/* logo +10% */
.top-logo{
  width:40px;
  height:auto;
}
.top-brand{
  font-weight:800;
  color:var(--accent);
}

/* compatibilidad */
.actions-right{
  margin-left:auto;
  display:inline-flex;
  gap:8px;
}

/* Sidebar */
.sidebar{
  position:fixed;
  inset:var(--topbar-h) auto 0 0;
  width:310px;
  background:var(--card-2);
  border-right:1px solid var(--stroke);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.sidebar-header{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color:var(--accent);
}
.sidebar-header img{width:28px;height:auto}

.menu{
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* items con icono + texto */
.menu-item{
  position:relative;
  padding:10px 12px 10px 34px; /* espacio para indicador */
  border:1px solid var(--stroke);
  border-radius:10px;
  text-decoration:none;
  color:#fff;
  background:#1f2024;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  white-space:nowrap;
  overflow:hidden;
  min-height:44px;
  transform:translateZ(0);
  will-change:transform, background-color, border-color, color;
  transition:background-color .18s ease, border-color .18s ease, transform .18s ease, color .18s ease;
}
.menu-item img,
.menu-item svg{
  width:18px;
  height:18px;
  flex:0 0 18px;
}
.menu-item span{
  flex:1 1 auto;
  min-width:0;
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.menu-item::before{
  content:"";
  position:absolute;
  left:12px;
  top:50%;
  width:4px;
  height:22px;
  border-radius:8px;
  transform:translateY(-50%);
  background:transparent;
  transition:background-color .18s ease;
}
.menu-item:hover{
  border-color:var(--accent);
  background:rgba(255,140,26,.10);
  transform:translateX(1px);
}
.menu-item:active{
  transform:translateX(1px) scale(.99);
}
.menu-item.active{
  border-color:var(--accent);
  background:rgba(255,140,26,.22);
  color:#fff;
}
.menu-item.active::before{
  background:var(--accent);
}
@media (prefers-reduced-motion: reduce){
  .menu-item{ transition:none; }
  .menu-item::before{ transition:none; }
  .menu-item:hover{ transform:none; }
  .menu-item:active{ transform:none; }
}

.sidebar-footer{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* contenido */
.workspace{
  margin-left:310px;
  padding:20px;
  max-width:1100px;
  margin-top:calc(var(--topbar-h) + 12px);
}

.section{
  margin-bottom:22px;
  max-width:980px;
  margin-left:auto;
  margin-right:auto;
  scroll-margin-top:calc(var(--topbar-h) + 12px);
}
.panel-title{
  display:inline-block;
  margin:0 0 10px 0;
  padding:6px 12px;
  background:#2b2d33;
  border:2px solid var(--accent);
  color:#fff;
  border-radius:999px;
  box-shadow:var(--shadow);
}

.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:12px;
}
.table thead th{
  background:var(--accent);
  color:#181818;
  padding:8px;
  text-align:left;
}
.table tbody td{
  border-bottom:1px solid var(--stroke);
  padding:8px;
}

/* ========= TABLA: HISTORIAL DE EVENTOS (Supervisor) ========= */
.table-events{
  table-layout:fixed;
  width:100%;
}
.table-events th,
.table-events td{
  padding:8px 10px;
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap !important;
  vertical-align:top;
}
.table-events th:nth-child(7),
.table-events td:nth-child(7){
  /* Detalle: permitir varias líneas */
  white-space:normal !important;
  overflow:visible;
  text-overflow:clip;
}

.only-supervisor{display:none}
.readonly .form input,
.readonly .form select,
.readonly .form textarea{
  pointer-events:none;
  opacity:.55;
}
.readonly .form button[type="submit"]{
  pointer-events:none;
  opacity:.55;
}

/* ========= RESPONSIVE ========= */
@media (max-width:920px){
  .workspace{
    margin-left:0;
    padding:16px;
    max-width:100%;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .sidebar{
    position:static;
    width:auto;
    border-right:none;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    inset:auto;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .menu{
    flex-direction:row;
    flex-wrap:wrap;
  }
}

@media print{
  .sidebar, .menu, .sidebar-footer, .topbar { display:none !important; }
  .workspace{ margin:0; padding:0; max-width:100% }
  .section{ page-break-inside: avoid; margin: 0 0 16px 0 }
  .table thead th, .table tbody td{ padding:6px }
  .panel-title{
    border: 1px solid #000;
    color:#000;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
}


/* --- Legacy layout/utilities (kept to avoid losing behavior) --- */
*{box-sizing:border-box}
html,body{height:100%}
html{scroll-padding-top:var(--topbar-h)}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

.bg-app{background:var(--bg)}

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.title{
  font-size:1.6rem;
  font-weight:800;
  color:#F9FAFB;
  margin:.25rem 0 1rem 0;
  text-align:center;
}
.subtitle{color:var(--muted)}
.center{text-align:center}
.mt-sm{margin-top:.75rem}
.mt-lg{margin-top:1.25rem}
.w-100{width:100%}

.tag{
  display:inline-block;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  color:var(--muted);
  background:var(--card-2);
}

.btn{
  border:0;
  padding:12px 16px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.btn-primary{
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#020617;
}
.btn-small{
  padding:6px 10px;
  border-radius:8px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:var(--card-2);
  color:var(--text);
  border:1px solid var(--stroke);
}
.btn-small:hover{
  border-color:var(--accent);
}

/* inputs genéricos */
.input{
  background:#020617;
  border:1px solid var(--stroke);
  color:#F9FAFB;
  padding:11px 12px;
  border-radius:10px;
  width:100%;
}
.input::placeholder{
  color:var(--muted);
}

/* tamaños específicos */
.input-qty{
  width:120px;      /* cantidad hasta 6 dígitos */
}
.input-date{
  width:180px;      /* solo fecha */
}
.input-datetime{
  width:230px;      /* fecha + hora */
}

.label{color:var(--muted);margin-top:.25rem}

.login-wrapper{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:32px;
}
.login-card{
  width:min(380px,94vw);
  text-align:center;
}
.brand-mark{
  width:64px;
  height:auto;
  display:block;
  margin:0 auto 8px auto;
}

/* ========= ICONOS ========= */

.icon-img{
  width:18px;
  height:18px;
  display:block;
  flex-shrink:0;
}

/* ========= PANEL ========= */

.topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:50;
  background:#020617;
  border-bottom:1px solid var(--stroke);
}
.topbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
}

/* grupos topbar */
.top-left{
  display:flex;
  align-items:center;
  gap:8px;
}
.top-center{
  flex:1;
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.top-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

/* logo */
.top-logo{
  width:40px;
  height:auto;
}
.top-brand{
  font-weight:800;
  letter-spacing:.06em;
  color:var(--accent);
  text-transform:uppercase;
}

/* compatibilidad */
.actions-right{
  margin-left:auto;
  display:inline-flex;
  gap:8px;
}

/* Sidebar */
.sidebar{
  position:fixed;
  inset:var(--topbar-h) auto 0 0;
  width:310px;
  background:var(--card-2);
  border-right:1px solid var(--stroke);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.sidebar-header{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color:var(--accent);
}
.sidebar-header img{width:28px;height:auto}

.menu{
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* items con icono + texto */
:root{
  --bg:#202225; --card:#2a2c31; --card-2:#24262a;
  --accent:#ff8c1a; --accent-2:#ffad42; --text:#e8e8e8;
  --muted:#bdbdbd; --stroke:#3a3d44; --shadow:0 8px 22px rgba(0,0,0,.35); --radius:14px; --topbar-h:64px;
}
*{box-sizing:border-box}
html,body{height:100%}
html{scroll-padding-top:var(--topbar-h)}

body.theme-light{
  --bg:#f3f5f7;
  --card:#ffffff;
  --card-2:#f0f2f5;
  --text:#111827;
  --muted:#4b5563;
  --stroke:#d1d5db;
  --shadow:0 10px 26px rgba(0,0,0,.12);
}
body.theme-light .input{ background:#ffffff; color:#111827; }
body.theme-light .menu-item{ background:#ffffff; color:#111827; }
body.theme-light .menu-item:hover{ background:rgba(255,140,26,.12); }

body.theme-light .topbar{ background:linear-gradient(180deg,#ffffff 0%, #f3f5f7 100%); }
body.theme-light .sidebar{ background:var(--card-2); }
body.theme-light .panel-title{ background:#ffffff; color:#111827; }


body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

.bg-app{background:var(--bg)}

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.title{
  font-size:1.6rem;
  font-weight:800;
  color:#fff;
  margin:.25rem 0 1rem 0;
  text-align:center;
}
.subtitle{color:var(--muted)}
.center{text-align:center}
.mt-sm{margin-top:.75rem}
.mt-lg{margin-top:1.25rem}
.w-100{width:100%}

.tag{
  display:inline-block;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  color:var(--muted);
  background:var(--card-2);
}

.btn{
  border:0;
  padding:12px 16px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.btn-primary{
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#181818;
}
.btn-small{
  padding:6px 10px;
  border-radius:8px;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:#ffffff;
  color:#181818;
  border:1px solid rgba(0,0,0,.18);
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.btn-small:hover{filter:brightness(.98)}
.btn-small:active{transform:translateY(1px)}
.btn-small:hover{
  border-color:var(--accent);
  box-shadow:0 8px 18px rgba(0,0,0,.22);
}
.btn-small:active{ transform:translateY(1px); }
.btn-small:focus{ outline:2px solid rgba(255,140,26,.35); outline-offset:2px; }


/* inputs genéricos */
.input{
  background:#1f2024;
  border:1px solid var(--stroke);
  color:#fff;
  padding:11px 12px;
  border-radius:10px;
  width:100%;
}

/* tamaños específicos */
.input-qty{
  width:120px;      /* cantidad hasta 6 dígitos */
}
.input-date{
  width:180px;      /* solo fecha */
}
.input-datetime{
  width:230px;      /* fecha + hora */
}

.label{color:var(--muted);margin-top:.25rem}

.login-wrapper{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:32px;
}
.login-card{
  width:min(380px,94vw);
  text-align:center;
}
.brand-mark{
  width:64px;
  height:auto;
  display:block;
  margin:0 auto 8px auto;
}

/* ========= ICONOS ========= */

.icon-img{
  width:18px;
  height:18px;
  display:block;
  flex-shrink:0;
}

/* ========= PANEL ========= */

.topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:50;
  background:linear-gradient(180deg,#1b1d21 0%, #16171a 100%);
  border-bottom:1px solid var(--stroke);
  backdrop-filter:saturate(140%) blur(6px);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
}

/* grupos topbar */
.top-left{
  display:flex;
  align-items:center;
  gap:8px;
}
.top-center{
  flex:1;
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.top-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

/* logo +10% */
.top-logo{
  width:40px;
  height:auto;
}
.top-brand{
  font-weight:800;
  color:var(--accent);
}

/* compatibilidad */
.actions-right{
  margin-left:auto;
  display:inline-flex;
  gap:8px;
}

/* Sidebar */
.sidebar{
  position:fixed;
  inset:var(--topbar-h) auto 0 0;
  width:310px;
  background:var(--card-2);
  border-right:1px solid var(--stroke);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.sidebar-header{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color:var(--accent);
}
.sidebar-header img{width:28px;height:auto}

.menu{
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* items con icono + texto */
.menu-item{
  position:relative;
  padding:10px 12px 10px 34px; /* espacio para indicador */
  border:1px solid var(--stroke);
  border-radius:10px;
  text-decoration:none;
  color:#fff;
  background:#1f2024;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  white-space:nowrap;
  overflow:hidden;
  min-height:44px;
  transform:translateZ(0);
  will-change:transform, background-color, border-color, color;
  transition:background-color .18s ease, border-color .18s ease, transform .18s ease, color .18s ease;
}
.menu-item img,
.menu-item svg{
  width:18px;
  height:18px;
  flex:0 0 18px;
}
.menu-item span{
  flex:1 1 auto;
  min-width:0;
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.menu-item::before{
  content:"";
  position:absolute;
  left:12px;
  top:50%;
  width:4px;
  height:22px;
  border-radius:8px;
  transform:translateY(-50%);
  background:transparent;
  transition:background-color .18s ease;
}
.menu-item:hover{
  border-color:var(--accent);
  background:rgba(255,140,26,.10);
  transform:translateX(1px);
}
.menu-item:active{
  transform:translateX(1px) scale(.99);
}
.menu-item.active{
  border-color:var(--accent);
  background:rgba(255,140,26,.22);
  color:#fff;
}
.menu-item.active::before{
  background:var(--accent);
}
@media (prefers-reduced-motion: reduce){
  .menu-item{ transition:none; }
  .menu-item::before{ transition:none; }
  .menu-item:hover{ transform:none; }
  .menu-item:active{ transform:none; }
}

.sidebar-footer{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* contenido */
.workspace{
  margin-left:310px;
  padding:20px;
  max-width:1100px;
  margin-top:calc(var(--topbar-h) + 12px);
}

.section{
  margin-bottom:22px;
  max-width:980px;
  margin-left:auto;
  margin-right:auto;
  scroll-margin-top:calc(var(--topbar-h) + 12px);
}
.panel-title{
  display:inline-block;
  margin:0 0 10px 0;
  padding:6px 12px;
  background:#2b2d33;
  border:2px solid var(--accent);
  color:#fff;
  border-radius:999px;
  box-shadow:var(--shadow);
}

.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:12px;
}
.table thead th{
  background:var(--accent);
  color:#181818;
  padding:8px;
  text-align:left;
}
.table tbody td{
  border-bottom:1px solid var(--stroke);
  padding:8px;
}

/* ========= TABLA: HISTORIAL DE EVENTOS (Supervisor) ========= */
.table-events{
  table-layout:fixed;
  width:100%;
}
.table-events th,
.table-events td{
  padding:8px 10px;
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap !important;
  vertical-align:top;
}
.table-events th:nth-child(7),
.table-events td:nth-child(7){
  /* Detalle: permitir varias líneas */
  white-space:normal !important;
  overflow:visible;
  text-overflow:clip;
}

.only-supervisor{display:none}
.readonly .form input,
.readonly .form select,
.readonly .form textarea{
  pointer-events:none;
  opacity:.55;
}
.readonly .form button[type="submit"]{
  pointer-events:none;
  opacity:.55;
}

/* ========= RESPONSIVE ========= */
@media (max-width:920px){
  .workspace{
    margin-left:0;
    padding:16px;
    max-width:100%;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .sidebar{
    position:static;
    width:auto;
    border-right:none;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    inset:auto;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .menu{
    flex-direction:row;
    flex-wrap:wrap;
  }
}

@media print{
  .sidebar, .menu, .sidebar-footer, .topbar { display:none !important; }
  .workspace{ margin:0; padding:0; max-width:100% }
  .section{ page-break-inside: avoid; margin: 0 0 16px 0 }
  .table thead th, .table tbody td{ padding:6px }
  .panel-title{
    border: 1px solid #000;
    color:#000;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
}


/* --- Legacy layout/utilities (kept to avoid losing behavior) --- */
*{box-sizing:border-box}
html,body{height:100%}
html{scroll-padding-top:var(--topbar-h)}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}

.bg-app{background:var(--bg)}

.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.title{
  font-size:1.6rem;
  font-weight:800;
  color:#F9FAFB;
  margin:.25rem 0 1rem 0;
  text-align:center;
}
.subtitle{color:var(--muted)}
.center{text-align:center}
.mt-sm{margin-top:.75rem}
.mt-lg{margin-top:1.25rem}
.w-100{width:100%}

.tag{
  display:inline-block;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  color:var(--muted);
  background:var(--card-2);
}

.btn{
  border:0;
  padding:12px 16px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.btn-primary{
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#020617;
}
.btn-small{
  padding:6px 10px;
  border-radius:8px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:var(--card-2);
  color:var(--text);
  border:1px solid var(--stroke);
}
.btn-small:hover{
  border-color:var(--accent);
}

/* inputs genéricos */
.input{
  background:#020617;
  border:1px solid var(--stroke);
  color:#F9FAFB;
  padding:11px 12px;
  border-radius:10px;
  width:100%;
}
.input::placeholder{
  color:var(--muted);
}

/* tamaños específicos */
.input-qty{
  width:120px;      /* cantidad hasta 6 dígitos */
}
.input-date{
  width:180px;      /* solo fecha */
}
.input-datetime{
  width:230px;      /* fecha + hora */
}

.label{color:var(--muted);margin-top:.25rem}

.login-wrapper{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:32px;
}
.login-card{
  width:min(380px,94vw);
  text-align:center;
}
.brand-mark{
  width:64px;
  height:auto;
  display:block;
  margin:0 auto 8px auto;
}

/* ========= ICONOS ========= */

.icon-img{
  width:18px;
  height:18px;
  display:block;
  flex-shrink:0;
}

/* ========= PANEL ========= */

.topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:50;
  background:#020617;
  border-bottom:1px solid var(--stroke);
}
.topbar-inner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
}

/* grupos topbar */
.top-left{
  display:flex;
  align-items:center;
  gap:8px;
}
.top-center{
  flex:1;
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.top-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

/* logo */
.top-logo{
  width:40px;
  height:auto;
}
.top-brand{
  font-weight:800;
  letter-spacing:.06em;
  color:var(--accent);
  text-transform:uppercase;
}

/* compatibilidad */
.actions-right{
  margin-left:auto;
  display:inline-flex;
  gap:8px;
}

/* Sidebar */
.sidebar{
  position:fixed;
  inset:var(--topbar-h) auto 0 0;
  width:310px;
  background:var(--card-2);
  border-right:1px solid var(--stroke);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.sidebar-header{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color:var(--accent);
}
.sidebar-header img{width:28px;height:auto}

.menu{
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* items con icono + texto */
.menu-item{
  padding:10px 12px;
  border:1px solid var(--stroke);
  border-radius:10px;
  text-decoration:none;
  color:#F9FAFB;
  background:#020617;
  display:flex;
  align-items:center;
  gap:8px;
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sidebar-footer{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* contenido */
.workspace{
  margin-left:310px;
  padding:20px;
  max-width:1100px;
  margin-top:calc(var(--topbar-h) + 12px);
}

.section{
  margin-bottom:22px;
  max-width:980px;
  margin-left:auto;
  margin-right:auto;
  scroll-margin-top:calc(var(--topbar-h) + 12px);
}
.panel-title{
  display:inline-block;
  margin:0 0 10px 0;
  padding:6px 12px;
  background:#02081F;
  border:2px solid var(--accent);
  color:#E5F4FF;
  border-radius:999px;
  box-shadow:var(--shadow);
}

.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:12px;
}
.table thead th{
  background:var(--accent);
  color:#020617;
  padding:8px;
  text-align:left;
}
.table tbody td{
  border-bottom:1px solid var(--stroke);
  padding:8px;
}

.only-supervisor{display:none}
.readonly .form input,
.readonly .form select,
.readonly .form textarea{
  pointer-events:none;
  opacity:.55;
}
.readonly .form button[type="submit"]{
  pointer-events:none;
  opacity:.55;
}

/* ========= RESPONSIVE ========= */
@media (max-width:920px){
  .workspace{
    margin-left:0;
    padding:16px;
    max-width:100%;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .sidebar{
    position:static;
    width:auto;
    border-right:none;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    inset:auto;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .menu{
    flex-direction:row;
    flex-wrap:wrap;
  }
}

@media print{
  .sidebar, .menu, .sidebar-footer, .topbar { display:none !important; }
  .workspace{ margin:0; padding:0; max-width:100% }
  .section{ page-break-inside: avoid; margin: 0 0 16px 0 }
  .table thead th, .table tbody td{ padding:6px }
  .panel-title{
    border: 1px solid #000;
    color:#000;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
}

/* =========================================================
   BRUMAP – Ajustes de tipografía, contraste y compactación
   (Solo CSS: no altera funcionalidades)
   ========================================================= */

/* Tipografía un poco más sobria y consistente */
body{
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  letter-spacing: .1px;
}

.top-brand{
  letter-spacing: .6px;
}

/* Evitar “golpe visual”: suavizar superficies y sombras */
.card{
  padding:14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
}

body.theme-light .card{
  box-shadow: 0 10px 26px rgba(0,0,0,.10);
}

/* Títulos más compactos */
.panel-title{
  padding:5px 11px;
  font-size: 1.02rem;
}

/* Espaciado general un poco más eficiente */
.section{
  margin-bottom:18px;
}
.workspace{
  padding:18px;
}

/* Botones: mantener blancos en topbar, sin exceso de brillo */
.topbar .btn-small,
.topbar button.btn-small,
.topbar a.btn-small{
  background:#ffffff;
  color:#111827;
  border:1px solid #d1d5db;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.topbar .btn-small:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
}

/* ===== Formularios: mejor uso del espacio (cantidad + unidad en línea) ===== */
.form.two-col{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-start;
}

/* Inputs por defecto */
.form.two-col .input{
  flex: 1 1 300px;
  min-width: 220px;
  padding:10px 12px;
}

/* Cantidad: compacto */
.form.two-col .input-qty{
  flex: 0 0 120px;
  min-width: 120px;
}

/* Unidad: ocupa el resto de la fila */
.form.two-col select.input{
  flex: 1 1 260px;
  min-width: 200px;
}

/* Fecha: más compacto */
.form.two-col .input-date{
  flex: 0 0 170px;
  min-width: 170px;
}
.form.two-col .input-datetime{
  flex: 0 0 230px;
  min-width: 230px;
}

/* Acciones al final ocupan toda la fila */
.form.two-col .actions-row{
  flex: 1 1 100%;
  margin-top:4px;
}

/* ===== Filtros: panel más pequeño y en una sola línea ===== */
.card[data-filter-scope]{
  padding:12px;
}

.card[data-filter-scope] .tag{
  padding:5px 9px;
  font-size:.82rem;
}

.card[data-filter-scope] .actions-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.card[data-filter-scope] input[type="date"]{
  width:160px;
  flex: 0 0 160px;
  padding:9px 10px;
}
.card[data-filter-scope] .input-search{
  width:220px;
  flex:0 0 220px;
  padding:9px 10px;
}

.card[data-filter-scope] .input-qty{
  width:90px;
  flex:0 0 90px;
  padding:9px 10px;
}


.card[data-filter-scope] .btn-small{
  padding:7px 10px;
}

/* Tabla: un toque más compacta */
.table thead th{ padding:7px 8px; }
.table tbody td{ padding:7px 8px; }

/* ===== Responsive: mantener compacto sin romper legibilidad ===== */
@media (max-width:920px){
  .workspace{ padding:14px; }
  .form.two-col .input{ flex:1 1 100%; min-width: 0; }
  .form.two-col .input-qty{ flex:1 1 45%; min-width: 0; }
  .form.two-col select.input{ flex:1 1 55%; min-width: 0; }
  .card[data-filter-scope] input[type="date"]{ flex:1 1 48%; width:auto; }
}

/* Columna Tipo: más espacio (UI) */
.table th.col-tipo, .table td.col-tipo{ width: 38%; }

.table th.col-detalle, .table td.col-detalle{ width: 34%; }


/* === Botones blancos (estilo topbar) === */
.btn.btn-white{display:inline-flex;align-items:center;justify-content:center;gap:8px;}
.btn-white{
  background:#ffffff;
  color:#181818;
  border:1px solid rgba(0,0,0,.18);
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.btn-white:hover{filter:brightness(.98)}
.btn-white:active{transform:translateY(1px)}
.excel-badge{
  display:inline-grid;
  place-items:center;
  width:18px;height:18px;
  border-radius:6px;
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#181818;
  font-weight:900;
  font-size:12px;
}
.now-btn{padding:10px 12px; border-radius:10px}

/* Columna Tipo más amplia */
.table td:nth-child(2), .table th:nth-child(2){width:45%;}
.table td{vertical-align:top; word-break:break-word; white-space:normal;}


/* ========= Layout compacto: unidades + fecha/ahora ========= */
.input-unit{
  max-width: 200px;
  justify-self: end;
}
.date-row{
  display:flex;
  align-items:center;
  gap:10px;
}
.date-row .input{
  flex:1 1 auto;
  min-width: 0;
}
.date-row .now-btn{
  white-space:nowrap;
  padding:10px 14px;
}

/* Ajustes de campos para ahorrar espacio (sin romper responsive) */
.form.two-col .input-detalle,
.form.two-col .input-cliente{
  min-width: 0;
}
.form.two-col .input-razon{
  min-width: 0;
}

/* Tablas: permitir wrap en "Tipo" y celdas largas */
.table td{
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.table td.col-tipo, .table th.col-tipo{
  width: 42%;
}

/* ========= Acciones: registrar a la izquierda, exportar a la derecha ========= */
.actions-split{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}

/* En el HTML, "actions-right" contiene Registrar.
   Con order, lo forzamos a la izquierda sin tocar JS/HTML. */
.actions-right{
  order:1;
  display:flex;
  gap:10px;
  justify-content:flex-start;
  flex-wrap:nowrap;
}

/* "actions-left" contiene Exportar Excel/PDF. */
.actions-left{
  order:2;
  margin-left:auto;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:nowrap;
}

/* Botones compactos y homogéneos (Registrar/Exportar) */
.actions-split .btn{
  min-width:auto;
  padding:10px 12px;
  font-size:.92rem;
  border-radius:10px;
  line-height:1;
}

.actions-split .btn .icon-img{
  width:16px;
  height:16px;
}

/* Exportar (Excel/PDF): un poco más compacto y en una sola línea */
.actions-left .btn{
  padding:8px 10px;
  font-size:.86rem;
  border-radius:10px;
}

/* Recepciones: botones uniformes (Excel/PDF/Ajuste) */
.actions-left .btn.btn-uniform{
  width: 190px;
  height: 38px;
  padding: 8px 10px;
  font-size: .84rem;
  white-space: nowrap;
}
.actions-left{
  flex-wrap:nowrap;
}

@media (max-width:720px){
  .actions-right,
  .actions-left{
    width:100%;
    margin-left:0;
  }
  .actions-left{
    flex-wrap:wrap;
    justify-content:flex-start;
  }
  .actions-split .btn{
    width:100%;
  }
}
  .actions-split{gap:10px;}
  .actions-left, .actions-right{width:100%;}
}
.sidebar-footer{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* contenido */
.workspace{
  margin-left:310px;
  padding:20px;
  max-width:1100px;
  margin-top:calc(var(--topbar-h) + 12px);
}

.section{
  margin-bottom:22px;
  max-width:980px;
  margin-left:auto;
  margin-right:auto;
  scroll-margin-top:calc(var(--topbar-h) + 12px);
}
.panel-title{
  display:inline-block;
  margin:0 0 10px 0;
  padding:6px 12px;
  background:#02081F;
  border:2px solid var(--accent);
  color:#E5F4FF;
  border-radius:999px;
  box-shadow:var(--shadow);
}

.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:12px;
}
.table thead th{
  background:var(--accent);
  color:#020617;
  padding:8px;
  text-align:left;
}
.table tbody td{
  border-bottom:1px solid var(--stroke);
  padding:8px;
}

.only-supervisor{display:none}
.readonly .form input,
.readonly .form select,
.readonly .form textarea{
  pointer-events:none;
  opacity:.55;
}
.readonly .form button[type="submit"]{
  pointer-events:none;
  opacity:.55;
}

/* ========= RESPONSIVE ========= */
@media (max-width:920px){
  .workspace{
    margin-left:0;
    padding:16px;
    max-width:100%;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .sidebar{
    position:static;
    width:auto;
    border-right:none;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    inset:auto;
    margin-top:calc(var(--topbar-h) + 12px);
  }
  .menu{
    flex-direction:row;
    flex-wrap:wrap;
  }
}

@media print{
  .sidebar, .menu, .sidebar-footer, .topbar { display:none !important; }
  .workspace{ margin:0; padding:0; max-width:100% }
  .section{ page-break-inside: avoid; margin: 0 0 16px 0 }
  .table thead th, .table tbody td{ padding:6px }
  .panel-title{
    border: 1px solid #000;
    color:#000;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
}

/* =========================================================
   BRUMAP – Ajustes de tipografía, contraste y compactación
   (Solo CSS: no altera funcionalidades)
   ========================================================= */

/* Tipografía un poco más sobria y consistente */
body{
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  letter-spacing: .1px;
}

.top-brand{
  letter-spacing: .6px;
}

/* Evitar “golpe visual”: suavizar superficies y sombras */
.card{
  padding:14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
}

body.theme-light .card{
  box-shadow: 0 10px 26px rgba(0,0,0,.10);
}

/* Títulos más compactos */
.panel-title{
  padding:5px 11px;
  font-size: 1.02rem;
}

/* Espaciado general un poco más eficiente */
.section{
  margin-bottom:18px;
}
.workspace{
  padding:18px;
}

/* Botones: mantener blancos en topbar, sin exceso de brillo */
.topbar .btn-small,
.topbar button.btn-small,
.topbar a.btn-small{
  background:#ffffff;
  color:#111827;
  border:1px solid #d1d5db;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.topbar .btn-small:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0,0,0,.22);
}

/* ===== Formularios: mejor uso del espacio (cantidad + unidad en línea) ===== */
.form.two-col{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-start;
}

/* Inputs por defecto */
.form.two-col .input{
  flex: 1 1 300px;
  min-width: 220px;
  padding:10px 12px;
}

/* Cantidad: compacto */
.form.two-col .input-qty{
  flex: 0 0 120px;
  min-width: 120px;
}

/* Unidad: ocupa el resto de la fila */
.form.two-col select.input{
  flex: 1 1 260px;
  min-width: 200px;
}

/* Fecha: más compacto */
.form.two-col .input-date{
  flex: 0 0 170px;
  min-width: 170px;
}
.form.two-col .input-datetime{
  flex: 0 0 230px;
  min-width: 230px;
}

/* Acciones al final ocupan toda la fila */
.form.two-col .actions-row{
  flex: 1 1 100%;
  margin-top:4px;
}

/* ===== Filtros: panel más pequeño y en una sola línea ===== */
.card[data-filter-scope]{
  padding:12px;
}

.card[data-filter-scope] .tag{
  padding:5px 9px;
  font-size:.82rem;
}

.card[data-filter-scope] .actions-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.card[data-filter-scope] input[type="date"]{
  width:160px;
  flex: 0 0 160px;
  padding:9px 10px;
}
.card[data-filter-scope] .input-search{
  width:220px;
  flex:0 0 220px;
  padding:9px 10px;
}

.card[data-filter-scope] .input-qty{
  width:90px;
  flex:0 0 90px;
  padding:9px 10px;
}


.card[data-filter-scope] .btn-small{
  padding:7px 10px;
}

/* Tabla: un toque más compacta */
.table thead th{ padding:7px 8px; }
.table tbody td{ padding:7px 8px; }

/* ===== Responsive: mantener compacto sin romper legibilidad ===== */
@media (max-width:920px){
  .workspace{ padding:14px; }
  .form.two-col .input{ flex:1 1 100%; min-width: 0; }
  .form.two-col .input-qty{ flex:1 1 45%; min-width: 0; }
  .form.two-col select.input{ flex:1 1 55%; min-width: 0; }
  .card[data-filter-scope] input[type="date"]{ flex:1 1 48%; width:auto; }
}

/* Columna Tipo: más espacio (UI) */
.table th.col-tipo, .table td.col-tipo{ width: 38%; }

.table th.col-detalle, .table td.col-detalle{ width: 34%; }


/* === Botones blancos (estilo topbar) === */
.btn.btn-white{display:inline-flex;align-items:center;justify-content:center;gap:8px;}
.btn-white{
  background:#ffffff;
  color:#181818;
  border:1px solid rgba(0,0,0,.18);
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.btn-white:hover{filter:brightness(.98)}
.btn-white:active{transform:translateY(1px)}
.excel-badge{
  display:inline-grid;
  place-items:center;
  width:18px;height:18px;
  border-radius:6px;
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#181818;
  font-weight:900;
  font-size:12px;
}
.now-btn{padding:10px 12px; border-radius:10px}

/* Columna Tipo más amplia */
.table td:nth-child(2), .table th:nth-child(2){width:45%;}
.table td{vertical-align:top; word-break:break-word; white-space:normal;}


/* ========= Layout compacto: unidades + fecha/ahora ========= */
.input-unit{
  max-width: 200px;
  justify-self: end;
}
.date-row{
  display:flex;
  align-items:center;
  gap:10px;
}
.date-row .input{
  flex:1 1 auto;
  min-width: 0;
}
.date-row .now-btn{
  white-space:nowrap;
  padding:10px 14px;
}

/* Ajustes de campos para ahorrar espacio (sin romper responsive) */
.form.two-col .input-detalle,
.form.two-col .input-cliente{
  min-width: 0;
}
.form.two-col .input-razon{
  min-width: 0;
}

/* Tablas: permitir wrap en "Tipo" y celdas largas */
.table td{
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.table td.col-tipo, .table th.col-tipo{
  width: 42%;
}

/* ========= Acciones: registrar a la izquierda, exportar a la derecha ========= */
.actions-split{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}

/* En el HTML, "actions-right" contiene Registrar.
   Con order, lo forzamos a la izquierda sin tocar JS/HTML. */
.actions-right{
  order:1;
  display:flex;
  gap:10px;
  justify-content:flex-start;
  flex-wrap:nowrap;
}

/* "actions-left" contiene Exportar Excel/PDF. */
.actions-left{
  order:2;
  margin-left:auto;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:nowrap;
}

/* Botones compactos y homogéneos (Registrar/Exportar) */
.actions-split .btn{
  min-width:auto;
  padding:10px 12px;
  font-size:.92rem;
  border-radius:10px;
  line-height:1;
}

.actions-split .btn .icon-img{
  width:16px;
  height:16px;
}

/* Exportar (Excel/PDF): un poco más compacto y en una sola línea */
.actions-left .btn{
  padding:8px 10px;
  font-size:.86rem;
  border-radius:10px;
}
.actions-left{
  flex-wrap:nowrap;
}

@media (max-width:720px){
  .actions-right,
  .actions-left{
    width:100%;
    margin-left:0;
  }
  .actions-left{
    flex-wrap:wrap;
    justify-content:flex-start;
  }
  .actions-split .btn{
    width:100%;
  }
}
  .actions-split{gap:10px;}
  .actions-left, .actions-right{width:100%;}
}

/* ===== FIX MENU SIDEBAR (alineación 1 línea + indicador) ===== */
.sidebar .menu-item{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start;
  gap:10px;
  flex-wrap:nowrap !important;
  white-space:nowrap !important;
  min-height:46px;
  padding:10px 14px 10px 46px !important; /* reserva para indicador sin tapar ícono */
  line-height:1;
}

.sidebar .menu-item .icon-img,
.sidebar .menu-item img,
.sidebar .menu-item svg{
  width:18px;
  height:18px;
  flex:0 0 18px;
}

.sidebar .menu-item span{
  flex:1 1 auto;
  min-width:0;
  display:block;
  white-space:nowrap !important;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Indicador naranja (barra) sin estorbar el ícono */
.sidebar .menu-item::before{
  left:16px !important;
  top:50%;
  width:4px;
  height:24px;
  border-radius:10px;
  transform:translateY(-50%);
}

/* Evitar “saltos” por movimiento horizontal */
.sidebar .menu-item:hover,
.sidebar .menu-item:active{
  transform:none !important;
}



/* ===========================
   MENU SIDEBAR FIX (v7)
   - Single-line items (icon + text)
   - Same height for all items
   - No vertical orange indicator
   - Smooth, non-janky transitions
   =========================== */

.sidebar .menu-item,
.menu .menu-item{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:12px !important;

  /* force one-line layout */
  flex-wrap:nowrap !important;
  white-space:nowrap !important;

  /* consistent size */
  height:58px !important;
  padding:0 16px !important;

  /* prevent layout shifts */
  border:1px solid var(--stroke) !important;
  border-radius:18px !important;
  box-sizing:border-box !important;

  /* keep rendering lightweight */
  transform:none !important;
  will-change:auto !important;

  /* smooth but cheap transitions */
  transition:
    background-color .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    color .16s ease !important;
}

/* remove any indicator bars/pseudo elements that were shifting content */
.sidebar .menu-item::before,
.sidebar .menu-item::after,
.menu .menu-item::before,
.menu .menu-item::after{
  content:none !important;
  display:none !important;
}

/* icon sizing; avoid wrapping */
.sidebar .menu-item img,
.sidebar .menu-item svg,
.menu .menu-item img,
.menu .menu-item svg{
  width:22px !important;
  height:22px !important;
  flex:0 0 22px !important;
}

/* text: one line + ellipsis */
.sidebar .menu-item span,
.menu .menu-item span{
  flex:1 1 auto !important;
  min-width:0 !important;
  display:block !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  line-height:1.1 !important;
}

/* hover: subtle, no movement */
.sidebar .menu-item:hover,
.menu .menu-item:hover{
  transform:none !important;
}

/* active state: only orange shading, no size change */
.sidebar .menu-item.active,
.sidebar .menu-item[aria-current="page"],
.menu .menu-item.active,
.menu .menu-item[aria-current="page"]{
  background-color:rgba(255,140,26,.18) !important;
  border-color:rgba(255,140,26,.75) !important;
  box-shadow:0 0 0 1px rgba(255,140,26,.35) inset !important;
}

/* pressed state: tiny visual feedback, still no movement */
.sidebar .menu-item:active,
.menu .menu-item:active{
  box-shadow:0 0 0 2px rgba(255,140,26,.35) inset !important;
}




/* ================================
   Ajustes de tabla: Etiqueta vs Material
   ================================ */
table[data-table="recepciones"],
#stockTable,
#retirosTable{
  table-layout: fixed;
}

table[data-table="recepciones"] th:nth-child(1),
table[data-table="recepciones"] td:nth-child(1){ width: 125px; }
table[data-table="recepciones"] th.col-tipo,
table[data-table="recepciones"] td.col-tipo{ width: 56%; }
table[data-table="recepciones"] th.col-etiqueta,
table[data-table="recepciones"] td.col-etiqueta{ width: 18%; }
table[data-table="recepciones"] th:nth-child(4),
table[data-table="recepciones"] td:nth-child(4){ width: 95px; }
table[data-table="recepciones"] th:nth-child(5),
table[data-table="recepciones"] td:nth-child(5){ width: 105px; }

#stockTable th.col-material,
#stockTable td.col-material{ width: 50%; }
#stockTable th.col-etiqueta,
#stockTable td.col-etiqueta{ width: 18%; }
#stockTable th.col-num,
#stockTable td.col-num{ width: 95px; }
#stockTable th.col-date,
#stockTable td.col-date{ width: 160px; }

#retirosTable th.col-date,
#retirosTable td.col-date{ width: 170px; }
#retirosTable th.col-material,
#retirosTable td.col-material{ width: 55%; }
#retirosTable th.col-num,
#retirosTable td.col-num{ width: 95px; }

table[data-table="recepciones"] td.col-etiqueta,
#stockTable td.col-etiqueta{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Botones de vista en Stock */
.stock-toolbar .btn-small.active{
  background: var(--accent);
  border-color: rgba(0,0,0,.18);
  color: #181818;
}

/* =============================
   Visibilidad por rol
   ============================= */
body.role-supervisor .only-supervisor{ display:block; }
body.role-supervisor .menu-item.only-supervisor{ display:flex; }
body.role-supervisor .btn-small.only-supervisor{ display:inline-flex; }
body.role-supervisor .tag.only-supervisor{ display:inline-flex; }

/* =============================
   Paginación
   ============================= */
.pager{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  margin-top:10px;
  user-select:none;
}
.pager .pager-info{ color: var(--muted); font-size: .92rem; }
.pager .btn-small{ padding: 6px 10px; }

/* =============================
   Tablas: filas más compactas
   ============================= */
.table th, .table td{
  padding: 6px 10px !important;
  line-height: 1.15;
}

/* Stock toolbar: mantener botones al mismo nivel en escritorio */
.stock-toolbar{ align-items:center; gap:8px; flex-wrap:wrap; }
@media (min-width: 920px){
  .stock-toolbar{ flex-wrap:nowrap; }
}
.stock-toolbar .btn-small{ min-width: 150px; }

/* Badges */
.status-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  border:1px solid var(--stroke);
}
.status-badge.ok{ background: rgba(34,197,94,.18); color: #d1fae5; }
.status-badge.bad{ background: rgba(239,68,68,.18); color: #fee2e2; }



/* --- CUSTOM: compact tables & columns v12 --- */

/* Recepción: filas más compactas + ancho de columnas Tipo/Etiqueta */
#recepciones table[data-table="recepciones"] thead th{ padding:6px 8px; }
#recepciones table[data-table="recepciones"] tbody td{
  padding:5px 8px;
  font-size:13px;
  line-height:1.15;
}
#recepciones table[data-table="recepciones"] th:nth-child(2),
#recepciones table[data-table="recepciones"] td:nth-child(2){
  width: 280px;
}
#recepciones table[data-table="recepciones"] th:nth-child(3),
#recepciones table[data-table="recepciones"] td:nth-child(3){
  width: 160px; /* ~15-20 caracteres */
}
#recepciones table[data-table="recepciones"] td:nth-child(2),
#recepciones table[data-table="recepciones"] td:nth-child(3){
  white-space: normal;
  word-break: break-word;
}

/* Maquinaria: columna Máquina más estrecha y Descripción más amplia */
#maquinariaTable th:nth-child(2), #maquinariaTable td:nth-child(2){ width: 120px; }
#maquinariaTable th:nth-child(4), #maquinariaTable td:nth-child(4){ width: auto; }
#maquinariaTable td:nth-child(4){ white-space: normal; word-break: break-word; }

/* Repuestos: Repuesto más estrecho, Observaciones más amplio, Estado con más espacio */
#repuestosTable th:nth-child(2), #repuestosTable td:nth-child(2){ width: 150px; }
#repuestosTable th:nth-child(4), #repuestosTable td:nth-child(4){ width: auto; }
#repuestosTable td:nth-child(4){ white-space: normal; word-break: break-word; }
#repuestosTable th:nth-child(5), #repuestosTable td:nth-child(5){ width: 140px; }

/* Stock: columna Estado */
#stockTable .col-status{ width: 140px; }

/* =====================================================
   BRUMAP Inventario – Ajustes UI (v14)
   - Botones PDF/Excel con tamaño consistente
   - Modal de historial de entradas (recepciones_movimientos)
   ===================================================== */

/* Topbar: exportaciones completas (mismo ancho) */
.topbar .top-center .btn-small.export-full{
  min-width: 240px;
  justify-content: center;
  white-space: nowrap;
}

/* Iconos pequeños consistentes */
.icon-img-sm{
  width:18px;
  height:18px;
  display:block;
  flex-shrink:0;
}

/* Historial de retiros: botones mismos tamaños */
.retiros-actions .btn-small{
  min-width: 120px;
  justify-content: center;
}

/* Modal genérico */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card{
  width: min(980px, 96vw);
  max-height: 86vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,.45);
  padding: 14px;
}

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

.modal-title{
  font-size: 1.05rem;
  font-weight: 800;
}

.modal-subtitle{
  color: var(--muted);
  font-size: .92rem;
  margin-top: 2px;
}

.modal-summary{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-body{
  padding-top: 6px;
}

/* Acciones en tabla: evitar que los botones se desborden */
.table td.actions-row{
  flex-wrap: wrap;
}


/* Visibilidad por rol */
.role-operario .no-operario{ display:none !important; }



/* ========= UI: selects compactos para ordenamiento ========= */
.select-compact{
  width: fit-content !important;
  inline-size: max-content;
  min-width: 0 !important;
  max-width: 240px;
  flex: 0 0 auto !important;
  padding: 8px 10px !important;
  height: 34px;
  line-height: 1.1;
  white-space: nowrap;
}

/* Alineación fina: toolbars */
.stock-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.stock-toolbar .btn-small{
  height: 34px;
  padding: 8px 10px;
  white-space: nowrap;
}

/* Asegura que en desktop queden en una sola fila cuando haya espacio */
@media (min-width: 921px){
  .stock-toolbar{ flex-wrap: nowrap; }
}

/* ========= MÓVIL: menú lateral como drawer ========= */
.mobile-menu-btn{
  display:none;
  margin-right:10px;
  padding: 8px 10px;
  height: 36px;
  line-height: 1;
}

.sidebar-overlay{
  display:none;
  position:fixed;
  top:var(--topbar-h);
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,.55);
  z-index: 48;
}

@media (max-width:920px){
  .mobile-menu-btn{ display:inline-flex; align-items:center; justify-content:center; }

  /* Topbar: permite wrap sin romper */
  .topbar-inner{
    flex-wrap:wrap;
    gap:10px;
  }
  .top-center{
    width:100%;
    justify-content:flex-start;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:4px;
  }
  .top-center .export-full{
    flex:0 0 auto;
    white-space:nowrap;
  }

  /* Sidebar como drawer */
  .sidebar{
    position:fixed !important;
    top:var(--topbar-h);
    left:0;
    height: calc(100dvh - var(--topbar-h));
    width: 86vw;
    max-width: 340px;
    z-index: 49;
    transform: translateX(-105%);
    transition: transform .18s ease;
    border-right:1px solid var(--stroke);
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    margin-top:0 !important;
  }
  body.sidebar-open .sidebar{ transform: translateX(0); }
  body.sidebar-open .sidebar-overlay{ display:block; }
  body.sidebar-open{ overflow:hidden; }

  /* Menú en columna en mobile */
  .menu{
    flex-direction:column !important;
    flex-wrap:nowrap !important;
  }

  /* Workspace ocupa ancho total */
  .workspace{
    margin-left:0 !important;
    padding:14px !important;
    max-width:100% !important;
  }

  /* Tablas: scroll horizontal para mantener usabilidad */
  .table{
    display:block;
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  .table thead th,
  .table tbody td{
    white-space:nowrap;
  }

  /* Botones: área táctil */
  .btn-small{
    min-height: 40px;
  }
}

/* ===== Ajuste extra para pantallas muy pequeñas ===== */
@media (max-width:520px){
  .top-left .brand{
    gap:8px;
  }
  .top-left .brand-text{
    display:none; /* mantiene limpio el encabezado en pantallas pequeñas */
  }
}

.stock-toolbar .tag{ margin-left:auto; }
@media (max-width:920px){ .stock-toolbar .tag{ margin-left:0; } }
