/* ===== Trazabilidad DM Anticonceptivos — DSM Vilcún ===== */
* { box-sizing: border-box; }
:root {
  --azul: #0f4c81;
  --azul-claro: #e8f1f8;
  --verde: #1e7d46;
  --rojo: #b3261e;
  --ambar: #a05a00;
  --gris: #6b7280;
  --borde: #d7dee6;
  --ancho-formulario: 400px;
}
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f5f8;
}
a { color: var(--azul); }


/* --- Área de contenido: formulario a la izquierda (400 px) y listados a la derecha --- */
.contenido {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  column-gap: 20px; padding: 20px 26px; min-width: 0;
}
/* Listados y tablas: ocupan el sector derecho que resta */
.contenido > .panel.tabla-scroll,
.contenido > .panel:has(table),
.contenido > .panel:has(.timeline) { order: 2; flex: 1 1 0; min-width: 0; }

.pie { text-align: center; font-size: 12px; color: var(--gris); padding: 12px; }

/* --- Tarjetas y paneles --- */
h1 { font-size: 20px; margin: 0 0 16px; color: var(--azul); }
h2 { font-size: 16px; margin: 22px 0 10px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 14px; }
.tarjeta .num { font-size: 26px; font-weight: 700; color: var(--azul); }
.tarjeta .lbl { font-size: 12px; color: var(--gris); }

/* --- Formularios: un elemento por línea (barra lateral de 400 px) --- */
form.fila, .form-grid {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;   /* un control por línea */
  align-items: start;
}
.form-grid > div { width: 100%; align-self: start !important; }
label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 9px; border: 1px solid var(--borde); border-radius: 6px;
  font-size: 13px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd6ee; border-color: var(--azul); }
.form-acciones { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

body {
	background-color: #FFF;
	margin: 0px !important;
	padding: 0px !important;
	height: 100%;
	width: 100%;
	overflow: auto;
    font-family: gobCL;
}

@font-face {
	font-family: "gobCL";
	font-weight: 300;
	font-style: normal;
	src: url("fonts/gobcl_light.woff") format("woff");
}
@font-face {
	font-family: "gobCL";
	font-weight: 500;
	font-style: normal;
	src: url("fonts/gobcl_regular.woff") format("woff");
}
@font-face {
	font-family: "gobCL";
	font-weight: 700;
	font-style: normal;
	src: url("fonts/gobcl_bold.woff") format("woff");
}
@font-face {
	font-family: "gobCL";
	font-weight: 900;
	font-style: normal;
	src: url("fonts/gobcl_heavy.woff") format("woff");
}

* {
	box-sizing: border-box;
}
header {
	position: fixed;
	top: 0px;
	left : 0px;
	right: 0px;
	height: 50px;
	background: #033750;
}
.bar-user{
	position: fixed;
	bottom: 0px;
	left : 0px;
	right: 0px;
	height: 20px;
	z-index: 300000;
}
.sidebar {
    width: 100% !important;
    height: 40px !important;
    display: flex;
    align-items: center;
    z-index: 10000;
	position: fixed;
	top: 8px; 
	right: 4px;
	left: 0px;
	text-align: center;
}

.sidebar ul {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    gap: 2px;
    padding: 0 10px !important;
    margin: 0 !important;
    list-style: none;
}

.sidebar li {
    display: block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar a {
    display: block;
    width: auto !important;
    height: 45px;
    padding: 0 4px;
    margin: 0 !important;
    box-sizing: border-box;
    white-space: nowrap;
    border-radius: 8px 8px 0px 0px !important;
    line-height: 46px;
    text-decoration: none;
    text-align: center;
    background-color: #01859a;
    color: white;
    font-family: gobCL;
    font-size: 12pt;
}

.panel {
	background: #eff4f8;
	padding-left: 30px;
	padding-right: 30px;
	padding-bottom: 30px;
}

.form-grid div label {
    display: block;
    color: #387ED9;
    font-family: gobCL;
    font-weight: 600;
    font-size: 10.5pt;
    margin-top: 4pt;
    margin-bottom: 0px;
}

.form-grid div select {
    display: block;
    font-family: gobCL;
    width: 100%;
    font-size: 14pt;
    border-width: 1px;
    border-style: solid;
    border-top-style: hidden;
    border-left-style: hidden;
    border-right-style: hidden;
    padding: 5px 6px 2px;
    border-color: #1E90FF;
    background-color: #FFFFFF;
}

.form-grid div input {
    display: block;
    font-family: gobCL;
    width: 100%;
    font-size: 14pt;
    border-width: 1px;
    border-style: solid;
    border-top-style: hidden;
    border-left-style: hidden;
    border-right-style: hidden;
    padding: 5px 6px 2px;
    border-color: #1E90FF;
    background-color: #FFFFFF;
}

.form-grid div textarea {
    display: block;
    font-family: gobCL;
    width: 100%;
	min-height: 120px;
    font-size: 14pt;
    border-width: 1px;
    border-style: solid;
    border-top-style: hidden;
    border-left-style: hidden;
    border-right-style: hidden;
    padding: 5px 6px 2px;
    border-color: #1E90FF;
    background-color: #FFFFFF;
}

.panel input:focus, select:focus {
    border-bottom-color: #EE0000 !important;
    background-color: #FAFAFA;
}

*:focus {
    outline: none;
}




.panel {
	position: fixed;
	top : 50px;
	bottom: 70px;
	left: 0px;
	width: 400px;
	overflow-x: auto;
}

.tabla-scroll {
	left: 400px;
	right: 0px;
	bottom: 70px;
	width: initial;
	padding-left: 20px !important;
	padding-right: 20px !important;
	padding-bottom: 20px !important;
}


P.muted, H1, H2, H3 {
	sdisplay: none;
}

h3, h2 {
    font-size: 16pt;
    margin-top: 20px;
    font-weight: 200;
    border-bottom: solid 1px #1E90FF;
    margin-bottom: 0px;
    padding-bottom: 4px;
    color: #163052;
}

header strong {
    z-index: 20;
    top: 10px;
    left: 30px;
    position: fixed;
    font-family: gobCL;
    font-weight: 300;
    padding-bottom: 0px;
    color: #FFFFFF;
    padding-left: 0px;
    padding-top: 2px;
    font-size: 20pt;
    margin: auto;
    margin-bottom: 15px;
    position: fixed;
    top: 10px;
	display: none;
}


.form-acciones .btn, .form-grid button.btn, .form-grid a.btn {
    margin: 0px auto;
    padding: 0px;
    display: block;
    height: 40px;
    width: 100%;
    -moz-border-radius: 18px !important;
    -webkit-border-radius: 18px !important;
    -khtml-border-radius: 18px !important;
    border-radius: 18px !important;
    line-height: 40px;
    text-decoration: none;
    border: none;
    background-color: #01859a;
    color: white;
    font-family: gobCL;
    text-align: center;
    font-size: 12pt;
    margin-top: 17px;
    margin-bottom: 0px;
}

.imprimir {
    left: 0px;
    right: 0px;
    bottom: 0px;
    height: 70px;
    padding-right: 20px !important;
    position: fixed;
    text-align: center;
    background-color: #033750;
}
.imprimir .btn {
    margin: 0px auto;
    padding: 0px;
    display: block;
    height: 40px;
    width: 20%;
    -moz-border-radius: 18px !important;
    -webkit-border-radius: 18px !important;
    -khtml-border-radius: 18px !important;
    border-radius: 18px !important;
    line-height: 40px;
    text-decoration: none;
    border: none;
    background-color: #01859a;
    color: white;
    font-family: gobCL;
    text-align: center;
    font-size: 12pt;
    margin-top: 17px;
    margin-bottom: 0px;
}

.panel h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 14px; }
.tarjeta .num { font-size: 26px; font-weight: 700; color: var(--azul); }
.tarjeta .lbl { font-size: 12px; color: var(--gris); }

.filtros {
	position: fixed;
	top: 80px;
	right: 20px;
}

.topbar-user {
	position: fixed;
	bottom: 4px;
	left: 20px;
	z-index: 300000;
}

.btn-small {
    display: inline-block;
    width: 100%;
    height: 30px;
    margin: 2px !important;
    box-sizing: border-box;
    white-space: nowrap;
	border: none;
    border-radius: 8px !important;
    line-height: 30px;
    text-decoration: none;
    text-align: center;
    background-color: #01859a;
    color: white;
    font-family: gobCL;
    font-size: 12pt;
}

a.activo {
	background-color: #eff4f8 !important;
}

a:hover {
	background-color: grey !important;	
}

a.activo:hover {
	background-color: #eff4f8 !important;	
}

@media screen {
/* Ocultar encabezados */
table thead {
    display: none;
}

/* Cada fila se transforma en una ficha */
table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
}

/* Cada celda */
table tbody td {
    display: flex;
    flex-direction: column;
    border: none;
    padding: 4px;
    font-size: 13px;
}

/* Estilo de etiquetas */
table tbody td::before {
	content: attr(data-label);
    font-size: 10px;
    color: #777;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* Dispositivo ocupa toda la primera fila */
table tbody td:first-child {
    grid-column: 1 / -1;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
}

/* Adaptación a pantallas pequeñas */
@media (max-width: 700px) {
    table tbody tr {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sidebar a.activo {
    position: relative;
    background: #eff4f8;
    border-radius: 12px 12px 0 0;
	color: #000000;
}

/* Curvas inferiores */
.sidebar a.activo::before,
.sidebar a.activo::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
}

.sidebar a.activo::before {
    left: -10px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 6px 0 0 #eff4f8;
}

.sidebar a.activo::after {
    right: -10px;
    border-bottom-left-radius: 12px;
    box-shadow: 0 6px 0 0 #eff4f8;
}

.topbar-user span.nombre, .topbar-user a {
	color: white;
}


/* --- Tablas --- */
table { width: 100%; border-collapse: collapse; background: #eff4f8; }
th, td { border: 1px solid var(--borde); padding: 7px 9px; text-align: left; font-size: 13px; vertical-align: top; }
th { background: var(--azul-claro); font-size: 11pt; letter-spacing: .3px; color: #33475b; }
tr:nth-child(even) td { background: #fafbfd; }
.tabla-scroll { overflow-x: auto;}

/* --- Badges / estados --- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-ok       { background: #e3f4ea; color: var(--verde); }
.badge-aviso    { background: #fdf0dc; color: var(--ambar); }
.badge-error    { background: #fde8e6; color: var(--rojo); }
.badge-info     { background: #e8f1f8; color: var(--azul); }
.badge-gris     { background: #eceff3; color: #4b5563; }
.badge-rol-admin { background: #fde8e6; color: var(--rojo); }
.badge-rol-bodega { background: #e8f1f8; color: var(--azul); }
.badge-rol-profesional { background: #e3f4ea; color: var(--verde); }

/* --- Flash --- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash-ok    { background: #e3f4ea; color: var(--verde); border: 1px solid #bfe5cf; }
.flash-error { background: #fde8e6; color: var(--rojo); border: 1px solid #f3c1bd; }
.flash-aviso { background: #fdf0dc; color: var(--ambar); border: 1px solid #f0d5a8; }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f4c81, #1a6fb0); }
.login-box { background: #fff; border-radius: 10px; padding: 30px 34px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-box h1 { color: var(--azul); font-size: 18px; margin-bottom: 4px; }
.login-box p.sub { color: var(--gris); font-size: 12px; margin-top: 0; }
.login-box form { display: grid; gap: 12px; margin-top: 18px; grid-template-columns: 1fr; }
.login-box .btn { width: 100%; }

/* --- Timeline (simulación) --- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 3px solid var(--azul); }
.timeline li { position: relative; padding: 8px 0 8px 14px; }
.timeline li::before {
  content: ""; position: absolute; left: -30px; top: 13px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--azul); border: 2px solid #fff;
}
.timeline .fecha { font-size: 11px; color: var(--gris); display: block; }

/* --- Utilidades --- */
.derecha { text-align: right; }
.centro { text-align: center; }
.texto-rojo { color: var(--rojo); font-weight: 600; }
.texto-verde { color: var(--verde); font-weight: 600; }
.texto-ambar { color: var(--ambar); font-weight: 600; }
.muted { color: var(--gris); font-size: 12px; }
.mt { margin-top: 14px; }
.mono { font-family: Consolas, monospace; }
.aviso-caja { border-left: 4px solid var(--rojo); background: #fde8e6; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.aviso-caja.ambar { border-left-color: var(--ambar); background: #fdf0dc; }

/* --- Filtros de listado --- */
.panel-filtros { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.panel-filtros h1 { margin-bottom: 0; }
.filtros { display: flex; gap: 4px; }
.filtros a {
  padding: 5px 12px; border-radius: 6px; text-decoration: none;
  border: 1px solid var(--borde); background: #fff; font-size: 12px; color: #374151;
}
.filtros a.activo { background: var(--azul); color: #fff; border-color: var(--azul); }

/* --- Tabla de detalle (etiqueta:valor) --- */
table.detalle { border: none; }
table.detalle th { width: 190px; background: #f3f5f8; vertical-align: top; }

/* --- Fila destacada (alerta activa) --- */
tr.fila-activa td { background: #fdf6f5; }

/* --- Fila de checkbox dentro de formularios --- */
label.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
label.checkline input { width: auto; }

/* --- Pantallas angostas: apilar formulario y listados --- */
@media (max-width: 880px) {
  .sidebar-nota { display: none; }
  .contenido > .panel:has(form),
  .contenido > .panel.tabla-scroll,
  .contenido > .panel:has(table),
  .contenido > .panel:has(.timeline) {
    order: 0; flex: 1 1 100%; width: auto; max-width: none;
  }
}

/* --- Impresión --- */
.btn-impresion {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff !important; font-size: 12px; }
  .topbar, .sidebar, .pie, .flash, .btn-impresion { display: none !important; }
  .layout { display: block; min-height: auto; }
  .contenido { padding: 0; min-width: 0; display: block; }
  .contenido > .panel { width: auto; max-width: none; }
  h1 { color: #000; font-size: 16px; }
  .panel { border: none; border-radius: 0; box-shadow: none; break-inside: avoid; padding: 6px 0; }
  .panel h3 { font-size: 13px; }
  .tarjeta { border: 1px solid #999; break-inside: avoid; }
  .grid { gap: 6px; }
  form, .form-acciones, .filtros, .panel-filtros .filtros { display: none !important; }
  .panel-filtros { display: block; }
  table { width: 100%; font-size: 11px; }
  th, td { border: 1px solid #666 !important; padding: 4px 6px; font-size: 11px; }
  th { background: #e8f1f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { break-inside: avoid; }
  .badge { border: 1px solid #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .timeline { border-left-color: #333; }
  .timeline li::before { background: #333; }
  a { color: #000; text-decoration: none; }
  .tabla-scroll { top: 0px !important; overflow: visible; position: relative; padding: 0px; left: 0px !important; z-index: 30000}
  .imprimir, strong { display: none !important;  }
  .no-fin-col th:last-child,
  .no-fin-col td:last-child { display: none !important; }
}

.tabla-scroll {
	padding: 0px;
	background: #eff4f8;
}

