/* ==============================
   Matthew NDT - Tema Claro Dashboard UX (FINAL)
   ============================== */

:root{
  --bg:#f4f6f8;
  --header:#ffffff;
  --sidebar:#f8fafc;
  --card:#ffffff;
  --line:#e2e8f0;
  --text:#1e293b;
  --muted:#64748b;
  --brand:#2563eb;
  --hover:#e0e7ff;
  --danger:#dc2626;
  --success:#22c55e;
}

/* ===== Base global ===== */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  display:flex;
}

/* ===== Header ===== */
header{
  position:fixed;top:0;left:0;right:0;height:60px;
  background:var(--header);
  border-bottom:1px solid var(--line);
  display:flex;justify-content:space-between;align-items:center;
  padding:0 20px;z-index:100;
  box-shadow:0 1px 4px rgba(0,0,0,0.06);
}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;color:var(--brand)}
.logo img{height:90px;width:auto}
.user-info{display:flex;align-items:center;gap:20px;color:var(--muted);font-size:14px}
.datetime{font-variant-numeric:tabular-nums;color:var(--brand);font-weight:600}

/* ===== Sidebar ===== */
.sidebar{
  position:fixed;top:60px;left:0;bottom:0;width:240px;
  background:var(--sidebar);
  border-right:1px solid var(--line);
  display:flex;flex-direction:column;padding-top:20px;
  box-shadow:2px 0 8px rgba(0,0,0,0.04);
}
.sidebar a{
  color:var(--text);text-decoration:none;display:block;
  padding:12px 22px;font-weight:500;
  transition:background .2s,color .2s;border-left:4px solid transparent;
}
.sidebar a:hover{background:var(--hover);border-left-color:var(--brand);color:var(--brand)}
.sidebar a.active{background:var(--hover);border-left-color:var(--brand);color:var(--brand)}
.sidebar form{margin:16px 22px}
.sidebar button{
  width:100%;padding:10px;border:none;border-radius:8px;background:var(--danger);
  color:#fff;font-weight:600;cursor:pointer
}

/* ===== Main/Layout ===== */
main{
  margin-top:60px;margin-left:240px;
  padding:30px;
  width:calc(100% - 240px);
  min-height:calc(100vh - 60px);
}
.wrap{
  width:100%;
  max-width:none;      /* elimina límites para ocupar 100% */
  margin:0 auto;
}

/* ===== Cards ===== */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  padding:20px 24px;
  margin-bottom:20px;
  box-shadow:0 2px 6px rgba(0,0,0,0.04);
  transition:box-shadow .2s;
  width:100%;          /* asegura 100% del contenedor */
  max-width:100%;
}
.card:hover{box-shadow:0 3px 8px rgba(0,0,0,0.08)}
.card-header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.card-body{width:100%}

/* ===== Toolbars / Buscadores ===== */
.toolbar{
  display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;
  gap:10px;margin-bottom:14px
}
.toolbar .title{margin:0;font-size:1.25rem}
.toolbar-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.form-inline,.search-form,.form-toolbar{
  display:flex;flex-wrap:wrap;align-items:center;gap:8px
}
.form-inline input[type="text"],
.search-form input[type="text"],
.form-toolbar input[type="text"]{
  min-width:220px;
}

/* ===== Tables ===== */
.table-wrap,.table-container{width:100%;overflow-x:auto}
.table{width:100%;border-collapse:collapse;font-size:.92rem;table-layout:auto}
th,td{
  border-bottom:1px solid var(--line);
  padding:10px;text-align:left;vertical-align:middle;white-space:nowrap
}
th{background:var(--hover);font-weight:600}
.text-right{text-align:right}
.nowrap{white-space:nowrap}
.table-sm th,.table-sm td{padding:8px 10px}

/* Columna de acciones homogénea */
td.actions{
  white-space:nowrap;
  text-align:center;
}
td.actions .btn, td.actions .btn-outline{
  min-width:110px;           /* ancho mínimo para igualdad visual */
  text-align:center;
}
.table .btn, .table .btn-outline{margin-left:4px;margin-right:4px}

/* ===== Forms ===== */
input,select,textarea{
  width:100%;padding:10px;border-radius:8px;border:1px solid var(--line);
  background:#fff;color:var(--text);font-size:.95rem
}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--brand);box-shadow:0 0 0 2px rgba(37,99,235,.2)
}

/* ===== Buttons (pequeños, uniformes y centrados) ===== */
.btn{
  display:inline-block;
  background:var(--brand);
  color:#fff;
  padding:8px 12px;          /* botón pequeño */
  border-radius:6px;
  font-weight:600;
  font-size:.86rem;          /* texto compacto */
  border:none;
  cursor:pointer;
  text-decoration:none;
  text-align:center;         /* centra texto */
  white-space:nowrap;
  line-height:1.2;
  transition:background .2s, box-shadow .2s, transform .02s;
}
.btn:hover{background:#1d4ed8;box-shadow:0 2px 5px rgba(37,99,235,.2)}
.btn:active{transform:translateY(1px)}

.btn-outline{
  display:inline-block;
  background:transparent;
  color:var(--brand);
  padding:8px 12px;
  border-radius:6px;
  font-weight:600;
  font-size:.86rem;
  border:1px solid var(--brand);
  cursor:pointer;
  text-decoration:none;
  text-align:center;
  white-space:nowrap;
  line-height:1.2;
  transition:background .2s, color .2s, border-color .2s, transform .02s;
}
.btn-outline:hover{background:var(--hover)}
.btn-outline:active{transform:translateY(1px)}

.btn-danger{
  background:var(--danger);color:#fff;border:none
}
.btn.small,.btn-outline.small{padding:6px 10px;font-size:.8rem}

/* ===== Mini utilidades ===== */
.muted{color:var(--muted);font-size:.9rem}
.error{
  background:#fee2e2;color:#991b1b;border:1px solid #fecaca;
  padding:8px 12px;border-radius:6px;font-size:.9rem
}
.text-center{text-align:center}
.w-100{width:100%}
.mt-2{margin-top:.5rem}
.mt-3{margin-top:.75rem}

/* ===== Firmas (más pequeñas) ===== */
.signature-thumb{
  height:28px;              /* reducido */
  background:#fff;
  padding:3px;border-radius:6px;border:1px solid var(--line);
  display:block;margin:0 auto
}

/* ===== Footer ===== */
footer{
  margin-left:240px;padding:20px 30px;color:var(--muted);
  font-size:14px;border-top:1px solid var(--line);background:var(--card);text-align:center
}

/* ===== Login ===== */
.login-wrapper{
  display:flex;justify-content:center;align-items:center;
  min-height:calc(100vh - 120px);padding:40px 20px
}
.login-card{
  background:var(--card);border:1px solid var(--line);border-radius:12px;
  padding:28px;width:100%;max-width:420px;
  box-shadow:0 2px 6px rgba(0,0,0,.06)
}
.login-card h1{margin:0 0 4px;font-size:1.25rem;color:var(--text)}
.login-card p{margin:0;color:var(--muted)}

/* ===== Responsivo ===== */
@media (max-width: 1024px){
  .logo img{height:80px}
}
@media (max-width: 900px){
  .sidebar{width:210px}
  main{margin-left:210px;width:calc(100% - 210px)}
  footer{margin-left:210px}
}
@media (max-width: 720px){
  .logo img{height:64px}
  .sidebar{position:fixed;width:200px}
  main{margin-left:200px;width:calc(100% - 200px);padding:20px}
  footer{margin-left:200px}
  .form-inline input[type="text"],
  .search-form input[type="text"],
  .form-toolbar input[type="text"]{min-width:160px;flex:1}
}
@media (max-width: 560px){
  .sidebar{display:none}                /* oculta sidebar en móviles estrechos */
  main{margin-left:0;width:100%;padding:16px}
  footer{margin-left:0}
  .toolbar, .card-header{
    flex-direction:column;align-items:stretch;gap:10px
  }
  .toolbar-actions, .form-inline, .search-form, .form-toolbar{
    width:100%;gap:8px
  }
  .toolbar-actions > *{flex:1}
  td.actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
  td.actions .btn, td.actions .btn-outline{flex:1;min-width:0}
}



:root{
  /* altura del footer para cálculos */
  --footer-h: 56px;
}

/* MAIN: reserva espacio para el footer fijo */
main{
  margin-top:60px;
  margin-left:240px;
  padding:30px;
  width:calc(100% - 240px);
  min-height:calc(100vh - 60px);
  padding-bottom: calc(30px + var(--footer-h)); /* evita que el footer tape contenido */
}

/* FOOTER FIJO */
footer{
  position: fixed;
  left: 240px;           /* mismo ancho que la sidebar */
  right: 0;
  bottom: 0;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  z-index: 90;           /* debajo del header (100), encima del main */
  margin-left: 0;        /* anula el margen anterior */
  padding: 0 20px;       /* acolchado horizontal */
}

/* Breakpoints: sincroniza el left con el ancho real de la sidebar */
@media (max-width: 900px){
  main{ margin-left:210px; width:calc(100% - 210px); }
  footer{ left:210px; }
}
@media (max-width: 560px){
  /* en móvil ocultas la sidebar, el footer ocupa todo el ancho */
  main{ margin-left:0; width:100%; }
  footer{ left:0; }
}


/* Mantiene los elementos del form en una sola línea (si hay espacio) */
.no-wrap { flex-wrap: nowrap; }

/* Hace que el input “tome” el espacio disponible y empuje los botones a la derecha */
.input-grow {
  min-width: 260px;
  flex: 1 1 420px;
}

/* En pantallas chicas, deja que se apilen suavemente */
@media (max-width: 720px){
  .no-wrap { flex-wrap: wrap; }
  .input-grow { flex: 1 1 100%; }
}