:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted:#6b7280;
  --border:#e5e7eb;
 /* --primary:#2563eb; */
	
	--primary:#A61B2B;        /* granate claro */
--primaryHover:#8E1624;
--primarySoft:#FBE7EA;
	
  --sidebar:#0b1220;
  --sidebar2:#111a2e;
  --sidebarText:#e5e7eb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.07);
  --w-sidebar: 260px;
	

}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{ color:inherit; text-decoration:none; }
small{ color:var(--muted); }

.app{
  display:grid;
  grid-template-columns: var(--w-sidebar) 1fr;
  min-height:100vh;
}

/* Sidebar */
.sidebar{
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar2));
  color: var(--sidebarText);
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 14px;
}
.brand .logo{
  width:36px;height:36px;border-radius:10px;
  background: rgba(255,255,255,.12);
  display:grid;place-items:center;
  font-weight:800;
}
.brand .title{
  line-height:1.1;
}
.brand .title b{ display:block; font-size:14px; }
.brand .title span{ font-size:12px; opacity:.8; }

.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:14px;
}
.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(229,231,235,.92);
}
.nav a:hover{ background: rgba(255,255,255,.08); }
/*.nav a.active{ background: rgba(37,99,235,.22); outline: 1px solid rgba(37,99,235,.25); } */


.nav a.active{
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  outline: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
}

.nav .section{
  margin-top:14px;
  padding: 10px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .7;
}

/* Content */
.main{
  padding: 18px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}
.hamburger{
  display:none;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}
.hamburger:active{ transform: translateY(1px); }

.page-title{
  margin:0;
  font-size: 16px;
}
.page-subtitle{
  margin:0;
  font-size: 12px;
  color: var(--muted);
}

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

/* Buttons & inputs */
.btn{
  border: 1px solid var(--border);
  background:#fff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
}

/*
.btn.primary{
  background: var(--primary);
  color:#fff;
  border-color: rgba(37,99,235,.55);
} */


.btn.primary{
  background: var(--primary);
  color:#fff;
  border-color: rgba(166,27,43,.55);
}
.btn.primary:hover{
  background: var(--primaryHover);
}



.btn:active{ transform: translateY(1px); }

.input{
  width:100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}


/* Igualar altura select vs input */
/* Inputs normales */
.input{
  width:100%;
  min-height:44px;
  padding:10px 12px;
  font-size:14px;
  line-height:1.2;           /* <- normal */
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  box-sizing:border-box;
}

/* Select: centrado y sin “corte” en Safari */
select.input{
  -webkit-appearance:none;
  appearance:none;

  height:44px;
  line-height:44px;          /* <- centra texto */
  padding:0 38px 0 12px;     /* <- SIN padding vertical */
  font-size:14px;
  background:#fff;

  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M5.5 7.5 10 12l4.5-4.5 1.5 1.5L10 15 4 9z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  background-size:16px 16px;
}

/* iOS Safari: evita zoom y suele mejorar el rendering */
@supports (-webkit-touch-callout: none) {
  select.input{ font-size:16px; }
}
.brand-logo{
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

/* Responsive (sidebar off-canvas) */
@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    left: 0;
    top: 0;
    width: min(92vw, var(--w-sidebar));
    transform: translateX(-110%);
    transition: transform .2s ease;
    z-index: 50;
  }
  body.sidebar-open .sidebar{ transform: translateX(0); }
  .hamburger{ display:inline-block; }
  body.sidebar-open::before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 40;
  }
}

/* === Layout moderno tipo TSX (sin Tailwind) === */

.shell{
  display:flex;
  min-height:100vh;
  background: var(--bg);
}

.sidebar2{
  width:280px;
  flex:0 0 280px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar2));
  color: var(--sidebarText);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow:auto;
  z-index: 50;
  transform: translateX(0);
}

.content2{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.topbar2{
  position: sticky;
  top:0;
  z-index:30;
  background: rgba(255,255,255,.80);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
  padding: 14px 18px;
  box-shadow: 0 1px 0 rgba(2,6,23,.04);
}

.topbar2-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.topbar2-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.topbar2-title{
  font-size:18px;
  font-weight:900;
  color:#111827;
  letter-spacing:-.02em;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.main2{
  flex:1;
  padding: 16px;
}
@media (min-width: 768px){ .main2{ padding: 22px; } }
@media (min-width: 1024px){ .main2{ padding: 28px; } }

.container2{
  max-width: 1280px; /* max-w-7xl */
  width:100%;
  margin:0 auto;
}

/* Sidebar UI */
.sb-brand{
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  display:flex;
  gap:12px;
  align-items:center;
}
.sb-brand .logo-wrap{
  width:40px;height:40px;border-radius:14px;
  background: rgba(255,255,255,.10);
  display:grid;place-items:center;
  overflow:hidden;
}

/* .sb-brand img{ width:32px;height:32px;border-radius:10px; object-fit:cover; }*/
.sb-brand img{ height:32px;border-radius:1px; object-fit:cover; }
.sb-brand .t1{ font-weight:900; color:#fff; font-size:16px; line-height:1.1; }
.sb-brand .t2{ color: rgba(229,231,235,.70); font-size:12px; font-weight:600; }

.sb-user{
  padding: 14px 18px 6px;
}
.sb-user .box{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.06);
  border-radius:12px;
  padding: 10px 12px;
}
.sb-user .name{ color: rgba(229,231,235,.92); font-weight:800; font-size:13px; }
.sb-user .role{ color: rgba(255,255,255,.55); font-size:11px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas; margin-top:2px; }

.sb-nav{
  padding: 8px 12px 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.sb-section{
  padding: 14px 10px 6px;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color: rgba(255,255,255,.45);
  font-weight:800;
}
.sb-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: rgba(229,231,235,.85);
  transition: all .15s ease;
}
.sb-item:hover{ background: rgba(255,255,255,.08); color:#fff; }
.sb-item.active{
  background: rgba(178,38,54,.22);
  outline:1px solid rgba(178,38,54,.30);
  color:#fff;
}
.sb-icon{
  width:18px;height:18px; display:inline-block;
  color: rgba(229,231,235,.70);
}
.sb-item.active .sb-icon{ color: #ffd3da; }

.sb-footer{
  padding: 12px 14px;
  border-top:1px solid rgba(255,255,255,.06);
  text-align:center;
  color: rgba(255,255,255,.35);
  font-size:10px;
}

/* User badge en topbar */
.userbox{
  display:flex;
  align-items:center;
  gap:12px;
  padding-left:14px;
  border-left:1px solid var(--border);
}
.userbox .meta{ text-align:right; display:none; }
@media (min-width: 768px){ .userbox .meta{ display:block; } }
.userbox .meta .email{ font-size:13px; font-weight:800; color:#374151; }
.userbox .meta .role{ font-size:11px; color:#6b7280; text-transform:lowercase; }

.avatar{
  width:36px;height:36px;border-radius:999px;
  background: var(--primary);
  color:#fff;
  font-weight:900;
  display:grid;place-items:center;
  box-shadow: 0 2px 8px rgba(2,6,23,.10);
  border:2px solid #fff;
}

/* Mobile: sidebar off-canvas + overlay */
.sb-overlay{
  position: fixed;
  inset:0;
  background: rgba(0,0,0,.5);
  z-index:40;
  opacity:0;
  pointer-events:none;
  transition: opacity .2s ease;
}
.hamb2{
  display:inline-grid;
  place-items:center;
  width:38px;height:38px;
  border-radius:12px;
  border:0;
  background: transparent;
  color:#6b7280;
  cursor:pointer;
}
.hamb2:hover{ background:#f3f4f6; }

@media (max-width: 1023px){
  .sidebar2{
    position: fixed;
    left:0; top:0;
    transform: translateX(-110%);
    transition: transform .25s ease;
  }
  body.sb-open .sidebar2{ transform: translateX(0); }
  body.sb-open .sb-overlay{ opacity:1; pointer-events:auto; }
}


/* SEPARADOR TIPO HR */
	  .sep{
  grid-column: 1 / -1;          /* ocupa todo el ancho del grid */
  height: 1px;
  background: var(--border);     /* o #e5e7eb */
  margin: 10px 0;
}


/* EXPBAR */

.expbar{
  position:sticky;
  top:56px; /* ajusta a la altura real de tu topbar2 */
  z-index:40;
  background:#fff;
  border-bottom:1px solid var(--border);
}

/* ===== EXPEDIENTE BAR (topbar expediente) ===== */
/* =========================
   EXPEDIENTE BAR (2 filas)
   ========================= */
/* ===== EXPEDIENTE BAR (BASE DESKTOP) ===== */
.expbar{
  position:sticky;
  top:56px;               /* ajusta a tu topbar2 */
  z-index:40;
   background:#f3f4f6; 
  border-bottom:1px solid var(--border);
}

.expbar-row{
  max-width:1200px;
  margin:0 auto;
  padding:10px 16px;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
}

/* clave para que el nav no “reviente” el flex */
.expbar-left{flex:0 0 auto;}
.expbar-nav{
  flex:1 1 auto;
  min-width:0;

  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}

.expbar-link{
  display:inline-flex;     /* <-- para que icono + texto se vean */
  align-items:center;
  gap:6px;

  font-size:12px;
  font-weight:900;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#fff;
  text-decoration:none;
  color:#111827;
  white-space:nowrap;
}

.expbar-link.active{
  background:rgba(166,27,43,.12);
  border-color:rgba(166,27,43,.35);
  color:#A61B2B;
}

.exp-ico{
  width:16px;
  height:16px;
  flex:0 0 auto;
}

/* ===== MÓVIL: scroll SOLO horizontal ===== */
@media (max-width: 980px){
  .expbar-nav{
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    touch-action:pan-x;
    padding-bottom:6px;
    margin-bottom:-6px;
    justify-content:flex-start;
  }

  .expbar-nav::-webkit-scrollbar{ display:none; }
  .expbar-nav{ scrollbar-width:none; }

  .expbar-link{ flex:0 0 auto; }
}



/* EXPBAR */
/* SEMAFORO */
.estado-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid var(--border);
  background:#f3f4f6;
  border-radius:999px;
}

.estado-dot{
  width:14px;height:14px;
  border-radius:4px;            /* cuadradito */
  border:1px solid rgba(0,0,0,.18);
  cursor:pointer;
  padding:0;
  display:inline-block;
}

.estado-dot.green{ background:#10b981; }
.estado-dot.yellow{ background:#f59e0b; }
.estado-dot.red{ background:#ef4444; }

.estado-dot.active{
  outline:3px solid rgba(166,27,43,.25);
  outline-offset:2px;
}

.estado-txt{
  font-size:12px;
  font-weight:900;
  color:#111827;
  margin-left:4px;
  white-space:nowrap;
} 

/* ALERTAS */

.alert{margin:12px 0;padding:10px 12px;border-radius:12px;font-size:13px;font-weight:800}
.alert.ok{border:1px solid #bbf7d0;background:#f0fdf4;color:#14532d}
.alert.err{border:1px solid #fecaca;background:#fff1f2;color:#991b1b}

/* fondo gris que usamos para gestor */

.bg-soft{
  background:#f3f4f6;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:12px;
}
.bg-soft .lbl{display:block;font-weight:800;font-size:12px;margin-bottom:6px;color:#374151}
.bg-soft .input, .bg-soft select, .bg-soft textarea{ background:#fff; }

.bg-soft-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

@media (max-width: 820px){
  .bg-soft-grid{grid-template-columns:1fr;}
}

/* Acciones rápidas expediente (iconos pequeños) */
.exp-mini-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.exp-mini-btn{
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:#111827;
  text-decoration:none;
  cursor:pointer;
}

.exp-mini-btn:hover{ background:#f3f4f6; }

.exp-mini-btn i{
  font-size:16px;
  line-height:1;
}

.exp-mini-btn.is-done{
  background:#f3f4f6;
  border-color:#e5e7eb;
  color:#9ca3af;
}
.exp-mini-btn.is-done:hover{
  background:#eef2f7;
}